foomo-docs/assets/js/9a50dba7.1fb94058.js
2021-12-25 17:55:22 +00:00

1 line
11 KiB
JavaScript

"use strict";(self.webpackChunkfoomo=self.webpackChunkfoomo||[]).push([[2833],{3905:function(e,t,n){n.d(t,{Zo:function(){return l},kt:function(){return y}});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),f=p(n),y=o,d=f["".concat(s,".").concat(y)]||f[y]||u[y]||a;return n?r.createElement(d,c(c({ref:t},l),{},{components:n})):r.createElement(d,c({ref:t},l))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,c=new Array(a);c[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,c[1]=i;for(var p=2;p<a;p++)c[p]=n[p];return r.createElement.apply(null,c)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"},1641:function(e,t,n){n.r(t),n.d(t,{contentTitle:function(){return d},default:function(){return v},frontMatter:function(){return y},metadata:function(){return m},toc:function(){return h}});var r,o,a=n(3117),c=n(102),i=n(7294),s=n(3905),p=n(3746),l=(r=String.fromCharCode,o={compressToBase64:function(e){if(null==e)return"";var t=o._compress(e,6,(function(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e)}));switch(t.length%4){default:return t;case 1:return t+"===";case 2:return t+"==";case 3:return t+"="}},compressToUTF16:function(e){return null==e?"":o._compress(e,15,(function(e){return r(e+32)}))+" "},compressToUint8Array:function(e){for(var t=o.compress(e),n=new Uint8Array(2*t.length),r=0,a=t.length;a>r;r++){var c=t.charCodeAt(r);n[2*r]=c>>>8,n[2*r+1]=c%256}return n},compressToEncodedURIComponent:function(e){return null==e?"":o._compress(e,6,(function(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$".charAt(e)}))},compress:function(e){return o._compress(e,16,(function(e){return r(e)}))},_compress:function(e,t,n){if(null==e)return"";var r,o,a,c={},i={},s="",p="",l="",u=2,f=3,y=2,d=[],m=0,h=0;for(a=0;a<e.length;a+=1)if(s=e.charAt(a),Object.prototype.hasOwnProperty.call(c,s)||(c[s]=f++,i[s]=!0),p=l+s,Object.prototype.hasOwnProperty.call(c,p))l=p;else{if(Object.prototype.hasOwnProperty.call(i,l)){if(l.charCodeAt(0)<256){for(r=0;y>r;r++)m<<=1,h==t-1?(h=0,d.push(n(m)),m=0):h++;for(o=l.charCodeAt(0),r=0;8>r;r++)m=m<<1|1&o,h==t-1?(h=0,d.push(n(m)),m=0):h++,o>>=1}else{for(o=1,r=0;y>r;r++)m=m<<1|o,h==t-1?(h=0,d.push(n(m)),m=0):h++,o=0;for(o=l.charCodeAt(0),r=0;16>r;r++)m=m<<1|1&o,h==t-1?(h=0,d.push(n(m)),m=0):h++,o>>=1}0==--u&&(u=Math.pow(2,y),y++),delete i[l]}else for(o=c[l],r=0;y>r;r++)m=m<<1|1&o,h==t-1?(h=0,d.push(n(m)),m=0):h++,o>>=1;0==--u&&(u=Math.pow(2,y),y++),c[p]=f++,l=String(s)}if(""!==l){if(Object.prototype.hasOwnProperty.call(i,l)){if(l.charCodeAt(0)<256){for(r=0;y>r;r++)m<<=1,h==t-1?(h=0,d.push(n(m)),m=0):h++;for(o=l.charCodeAt(0),r=0;8>r;r++)m=m<<1|1&o,h==t-1?(h=0,d.push(n(m)),m=0):h++,o>>=1}else{for(o=1,r=0;y>r;r++)m=m<<1|o,h==t-1?(h=0,d.push(n(m)),m=0):h++,o=0;for(o=l.charCodeAt(0),r=0;16>r;r++)m=m<<1|1&o,h==t-1?(h=0,d.push(n(m)),m=0):h++,o>>=1}0==--u&&(u=Math.pow(2,y),y++),delete i[l]}else for(o=c[l],r=0;y>r;r++)m=m<<1|1&o,h==t-1?(h=0,d.push(n(m)),m=0):h++,o>>=1;0==--u&&(u=Math.pow(2,y),y++)}for(o=2,r=0;y>r;r++)m=m<<1|1&o,h==t-1?(h=0,d.push(n(m)),m=0):h++,o>>=1;for(;;){if(m<<=1,h==t-1){d.push(n(m));break}h++}return d.join("")}},o),u=function(e){var t="https://www.typescriptlang.org/play?#code/"+escape(l.compressToEncodedURIComponent(e.children));return i.createElement("div",null,i.createElement(p.ZP,(0,a.Z)({},p.lG,{code:e.children,language:"tsx"}),(function(e){var t=e.className,n=e.style,r=e.tokens,o=e.getLineProps,a=e.getTokenProps;return i.createElement("pre",{className:t,style:n},r.map((function(e,t){return i.createElement("div",o({line:e,key:t}),e.map((function(e,t){return i.createElement("span",a({token:e,key:t}))})))})))})),i.createElement("a",{href:t,className:"button button--primary"},"open in playground on www.typescriptlang.org"))},f=["components"],y={sidebar_label:"Objects"},d="Object declaration syntax in TypeScript",m={unversionedId:"frontend/typescript/objects",id:"frontend/typescript/objects",title:"Object declaration syntax in TypeScript",description:"{`",source:"@site/docs/frontend/typescript/objects.mdx",sourceDirName:"frontend/typescript",slug:"/frontend/typescript/objects",permalink:"/docs/frontend/typescript/objects",tags:[],version:"current",frontMatter:{sidebar_label:"Objects"},sidebar:"frontendSidebar",previous:{title:"Stack",permalink:"/docs/frontend/stack"},next:{title:"Spreading",permalink:"/docs/frontend/typescript/spreading"}},h=[],g={toc:h};function v(e){var t=e.components,n=(0,c.Z)(e,f);return(0,s.kt)("wrapper",(0,a.Z)({},g,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("h1",{id:"object-declaration-syntax-in-typescript"},"Object declaration syntax in TypeScript"),(0,s.kt)(u,{mdxType:"TypeScriptPlayground"},"\nlet foo:{[index:string]:number} = {\n foo: 1\n};\n"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-tsx"},"let foo:{[index:string]:number} = {\n foo: 1\n};\n\n")))}v.isMDXComponent=!0},3746:function(e,t,n){n.d(t,{ZP:function(){return m},lG:function(){return c}});var r=n(7410),o={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","at-rule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]},a=n(7294),c={Prism:r.default,theme:o};function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}var p=/\r\n|\r|\n/,l=function(e){0===e.length?e.push({types:["plain"],content:"\n",empty:!0}):1===e.length&&""===e[0].content&&(e[0].content="\n",e[0].empty=!0)},u=function(e,t){var n=e.length;return n>0&&e[n-1]===t?e:e.concat(t)},f=function(e,t){var n=e.plain,r=Object.create(null),o=e.styles.reduce((function(e,n){var r=n.languages,o=n.style;return r&&!r.includes(t)||n.types.forEach((function(t){var n=s({},e[t],o);e[t]=n})),e}),r);return o.root=n,o.plain=s({},n,{backgroundColor:null}),o};function y(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&-1===t.indexOf(r)&&(n[r]=e[r]);return n}var d=function(e){function t(){for(var t=this,n=[],r=arguments.length;r--;)n[r]=arguments[r];e.apply(this,n),i(this,"getThemeDict",(function(e){if(void 0!==t.themeDict&&e.theme===t.prevTheme&&e.language===t.prevLanguage)return t.themeDict;t.prevTheme=e.theme,t.prevLanguage=e.language;var n=e.theme?f(e.theme,e.language):void 0;return t.themeDict=n})),i(this,"getLineProps",(function(e){var n=e.key,r=e.className,o=e.style,a=s({},y(e,["key","className","style","line"]),{className:"token-line",style:void 0,key:void 0}),c=t.getThemeDict(t.props);return void 0!==c&&(a.style=c.plain),void 0!==o&&(a.style=void 0!==a.style?s({},a.style,o):o),void 0!==n&&(a.key=n),r&&(a.className+=" "+r),a})),i(this,"getStyleForToken",(function(e){var n=e.types,r=e.empty,o=n.length,a=t.getThemeDict(t.props);if(void 0!==a){if(1===o&&"plain"===n[0])return r?{display:"inline-block"}:void 0;if(1===o&&!r)return a[n[0]];var c=r?{display:"inline-block"}:{},i=n.map((function(e){return a[e]}));return Object.assign.apply(Object,[c].concat(i))}})),i(this,"getTokenProps",(function(e){var n=e.key,r=e.className,o=e.style,a=e.token,c=s({},y(e,["key","className","style","token"]),{className:"token "+a.types.join(" "),children:a.content,style:t.getStyleForToken(a),key:void 0});return void 0!==o&&(c.style=void 0!==c.style?s({},c.style,o):o),void 0!==n&&(c.key=n),r&&(c.className+=" "+r),c})),i(this,"tokenize",(function(e,t,n,r){var o={code:t,grammar:n,language:r,tokens:[]};e.hooks.run("before-tokenize",o);var a=o.tokens=e.tokenize(o.code,o.grammar,o.language);return e.hooks.run("after-tokenize",o),a}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(){var e=this.props,t=e.Prism,n=e.language,r=e.code,o=e.children,a=this.getThemeDict(this.props),c=t.languages[n];return o({tokens:function(e){for(var t=[[]],n=[e],r=[0],o=[e.length],a=0,c=0,i=[],s=[i];c>-1;){for(;(a=r[c]++)<o[c];){var f=void 0,y=t[c],d=n[c][a];if("string"==typeof d?(y=c>0?y:["plain"],f=d):(y=u(y,d.type),d.alias&&(y=u(y,d.alias)),f=d.content),"string"==typeof f){var m=f.split(p),h=m.length;i.push({types:y,content:m[0]});for(var g=1;g<h;g++)l(i),s.push(i=[]),i.push({types:y,content:m[g]})}else c++,t.push(y),n.push(f),r.push(0),o.push(f.length)}c--,t.pop(),n.pop(),r.pop(),o.pop()}return l(i),s}(void 0!==c?this.tokenize(t,r,c,n):[r]),className:"prism-code language-"+n,style:void 0!==a?a.root:{},getLineProps:this.getLineProps,getTokenProps:this.getTokenProps})},t}(a.Component),m=d}}]);