tutorial instalar español cli app angular webpack angular2-forms angular-cli typescript2.0

instalar - Cómo importar core-js Map en la aplicación generada angular-cli webpack



angular material (1)

El problema aquí es que las declaraciones para core-js redeclaran muchos tipos que proporciona TypeScript e incluye por defecto.

core-js pretende rellenar las especificaciones actuales y futuras de la biblioteca estándar de ECMAScript. TypeScript busca describir los tipos de esas mismas especificaciones actuales y futuras.

Las declaraciones de tipo disponibles para core-js solapan con las proporcionadas por el lenguaje.

Tiene algunas opciones sólidas que puede usar:

  1. En tsconfig.json, especifique "noLib": true en "compilerOptions" para indicar a TypeScript que se abstenga de incluir automáticamente sus declaraciones de biblioteca estándar integradas en el contexto de compilación.
  2. En tsconfig.json, especifique la opción "lib" , que le proporciona un control más detallado sobre las declaraciones de biblioteca estándar incluidas. Por ejemplo, puede especificar "lib": ["es2017.symbol.wellknown", "dom"] .
  3. Desinstale el paquete @ types / core-js y simplemente use los archivos de declaración incorporados de TypeScript como se "lib": ["es2017", "dom"] anteriormente especificando "lib": ["es2017", "dom"] . Continuará utilizando core-js , pero usará las propias definiciones de TypeScript para escribir la implementación.

Después de pasar un tiempo yendo y viniendo entre estas opciones, me parece que la opción 3 es la más fácil de mantener.

Tenga en cuenta que los archivos de declaración incluidos automáticamente por TypeScript dependen de la propiedad "target" en tsconfig.

^ 1.0.0-beta.11-webpack "ahora usa core-js para polyfills.

Estoy tratando de importar un mapa para usar en mi aplicación

import {Map} from ''core-js/es6/map'' //import {Map} from ''core-js/library/es6/map'' export function updatePayload(data: any, isDataValid: boolean): Map<string, any> { const payload: Map<string, any> = new Map<string, any>() payload.set(''data'', data) payload.set(''isDataValid'', isDataValid) return payload }

Incluso he agregado el archivo core-js d.ts usando

npm install --save @types/core-js (typescript 2.0 is used)

sin embargo, ninguna de las importaciones resuelve el símbolo del mapa.

¿Qué me estoy perdiendo?

EDIT 1 | Errores generados

Ahora puedo usar la entidad Map, pero estoy obteniendo muchos errores en el cosole, aunque puedo establecer / obtener claves / valores del mapa

client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:21:13 Duplicate identifier ''PropertyKey''.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:58:4 All declarations of ''name'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:118:4 Subsequent variable declarations must have the same type. Variable ''[Symbol.unscopables]'' must be of type ''{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...'', but here has type ''any''.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:235:4 All declarations of ''flags'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:249:4 All declarations of ''EPSILON'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:284:4 All declarations of ''MAX_SAFE_INTEGER'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:291:4 All declarations of ''MIN_SAFE_INTEGER'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:430:4 Subsequent variable declarations must have the same type. Variable ''[Symbol.toStringTag]'' must be of type ''"Symbol"'', but here has type ''string''.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:430:4 All declarations of ''[Symbol.toStringTag]'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:437:4 All declarations of ''prototype'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:465:4 All declarations of ''hasInstance'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:471:4 All declarations of ''isConcatSpreadable'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:477:4 All declarations of ''iterator'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:483:4 All declarations of ''match'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:489:4 All declarations of ''replace'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:495:4 All declarations of ''search'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:501:4 All declarations of ''species'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:507:4 All declarations of ''split'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:513:4 All declarations of ''toPrimitive'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:519:4 All declarations of ''toStringTag'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:525:4 All declarations of ''unscopables'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:582:4 Subsequent variable declarations must have the same type. Variable ''[Symbol.toStringTag]'' must be of type ''"Math"'', but here has type ''string''.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:582:4 All declarations of ''[Symbol.toStringTag]'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:586:4 Subsequent variable declarations must have the same type. Variable ''[Symbol.toStringTag]'' must be of type ''"JSON"'', but here has type ''string''.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:586:4 All declarations of ''[Symbol.toStringTag]'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:601:4 All declarations of ''size'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:607:4 All declarations of ''prototype'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:618:4 All declarations of ''size'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:624:4 All declarations of ''prototype'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:639:4 All declarations of ''prototype'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:653:4 All declarations of ''prototype'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:665:4 All declarations of ''value'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/@types/core-js/index.d.ts:777:4 All declarations of ''prototype'' must have identical modifiers.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423 client:49 [default] J:/workspace/angular2/ts/epimss/node_modules/typescript/lib/lib.es2015.core.d.ts:17:13 Duplicate identifier ''PropertyKey''.errors @ client:49sock.onmessage @ client:83EventTarget.dispatchEvent @ eventtarget.js:51(anonymous function) @ main.js:274SockJS._transportMessage @ main.js:272EventEmitter.emit @ emitter.js:50WebSocketTransport.ws.onmessage @ websocket.js:35wrapFn @ zone.js:769ZoneDelegate.invokeTask @ zone.js:356Zone.runTask @ zone.js:256ZoneTask.invoke @ zone.js:423