κ°λ¨ν μ¬ν μ μ₯μ: https://github.com/plantain-00/test , npm i && npm run build
μ΄ν μ€λ₯λ λ€μκ³Ό κ°μ΅λλ€.
node_modules/@types/core-js/index.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'.
node_modules/typescript/lib/lib.es6.d.ts(4133,14): error TS2300: Duplicate identifier 'PropertyKey'.
μμλ¨: app.ts
μ΄ λΉμ΄ μμΌλ―λ‘ μ€λ₯κ° μμ΅λλ€. @types/core-js
λ static/app.ts
λ©λλ€.
"devDependencies": {
"@types/core-js": "^0.9.34",
"core-js": "^2.4.1",
"typescript": "^2.0.3"
}
lib.es6μ ν¬ν¨λμ§ μμ core-jsμ μ΄λ€ λΆλΆμ΄ νμν©λκΉ? λ¨μν @types/core-js
μ€μΉνμ§ μμ μ μμ΅λκΉ?
@aciccarello core-js λ° @types/core-jsλ static/app.ts
νλ‘ νΈμλμμ μ¬μ©λλ©° μ΄ λΆλΆμ μ μλν©λλ€.
2κ°μ tsconfig.json
. νλλ λ°±μλμ©(es6, μ¬κΈ°μ μ€λ₯ λ°μ), λ€λ₯Έ νλλ νλ‘ νΈμλμ©(es5, μ€λ₯ μμ, μ μλν¨),
@plantain-00 μ΄κ±° μμλμ΄?
core-js(μ¬μ )μ λΉνμ€ κΈ°λ₯ μ€ μΌλΆλ₯Ό μ¬μ©νκ³ μΆμ§λ§ μ νμ΄ typescripts λΌμ΄λΈλ¬λ¦¬μ μΆ©λνλ λΉμ·ν λ¬Έμ κ° μμ΅λλ€.
@jefbarn λΉνμ€ κΈ°λ₯μ κ²½μ° μ루μ
μ΄ μμ΅λλ€.
νμ€ κΈ°λ₯μ κ²½μ° @types/core-js
λ₯Ό μ κ±°νκ³ import "core-js";
μ κ±° typescript/lib/lib.es6.d.ts
λμ tsconfig.json
λ€μκ³Ό κ°μ΄ 보μ
λλ€.
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"lib": [
"es2015",
"es5",
"dom",
"scripthost"
]
}
}
μ΄ λ¬Έμ λ μ¬μ ν νμν κ² κ°μ΅λλ€. λ€μ μ΄κ² μ΅λλ€.
@types\core-js
νκ³ ES6μ νκ²ν
νλ μ΄ λ¬Έμ κ° μμ΅λλ€.
@anorborg λ€μκ³Ό κ°μ λ°©λ²μ μ¬μ©νμ¬ μν©μ νμ νμ΅λλ€.
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"moduleResolution": "node",
"lib": ["es5", "dom"],
...
}
@jefbarn μλνμ΅λλ€. κΈ°λ³Έμ μΌλ‘ core-js
λ° typescript 2.x es6.d.ts
λΌμ΄λΈλ¬λ¦¬κ° μΆ©λνκ³ μ΄λ typescriptκ° es6.d.ts
μ¬μ©νμ§ μλλ‘ μ§μν©λλ€. λ _μμν_ μ루μ
μ μ 체 core-js
μ μλ₯Ό ν¬ν¨νλ λμ core-js
(μ: core-js-es6-object
)μ λν μΌλΆ λͺ¨λ μ ν μ μλ₯Ό λ§λλ κ²μ
λλ€. μ΄κ²μ λ‘컬μμ μμνλ €κ³ νμ§λ§ λ‘컬 μ¬μ©μ μ μ μ νμ΄ μλνλλ‘ ν μ μμ΅λλ€. μκ°μ΄ μλ€λ©΄ κ·Έκ²μ μμλ΄κ³ λͺ¨λ λͺ¨λμ λν PRμ λ§λ€λ €κ³ λ
Έλ ₯ν κ²μ
λλ€.
κ΄μ¬μ λκΈ° μν΄ λΆλͺμΉ©λλ€.
λ°©κΈ μ΄ ts ꡬμ±μ μ¬μ©νμ¬ tsc
2.2.0
λ‘ μ νλ‘μ νΈλ₯Ό λ§λ€μμ΅λλ€.
{
"compilerOptions": {
"outDir": "./build/",
"rootDir": "./src/",
"baseUrl": ".",
"sourceMap": true,
"noImplicitAny": false,
"module": "commonjs",
"target": "es6"
},
"include": [
"./src/**/*.ts"
],
"compileOnSave": false
}
λ€μκ³Ό κ°μ μ€λ₯κ° λ°μν©λλ€.
node_modules/@types/core-js/index.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'.
node_modules/@types/core-js/index.d.ts(85,5): error TS2687: All declarations of 'name' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(145,5): error TS2403: 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'.
node_modules/@types/core-js/index.d.ts(262,5): error TS2687: All declarations of 'flags' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(276,5): error TS2687: All declarations of 'EPSILON' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(311,5): error TS2687: All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(318,5): error TS2687: All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(457,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.toStringTag]' must be of type '"Symbol"', but here has type 'string'.
node_modules/@types/core-js/index.d.ts(457,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(464,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(492,5): error TS2687: All declarations of 'hasInstance' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(498,5): error TS2687: All declarations of 'isConcatSpreadable' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(504,5): error TS2687: All declarations of 'iterator' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(510,5): error TS2687: All declarations of 'match' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(516,5): error TS2687: All declarations of 'replace' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(522,5): error TS2687: All declarations of 'search' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(528,5): error TS2687: All declarations of 'species' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(534,5): error TS2687: All declarations of 'split' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(540,5): error TS2687: All declarations of 'toPrimitive' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(546,5): error TS2687: All declarations of 'toStringTag' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(552,5): error TS2687: All declarations of 'unscopables' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(609,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.toStringTag]' must be of type '"Math"', but here has type 'string'.
node_modules/@types/core-js/index.d.ts(609,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(613,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.toStringTag]' must be of type '"JSON"', but here has type 'string'.
node_modules/@types/core-js/index.d.ts(613,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(628,5): error TS2687: All declarations of 'size' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(634,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(645,5): error TS2687: All declarations of 'size' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(651,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(656,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
node_modules/@types/core-js/index.d.ts(664,27): error TS2344: Type 'K' does not satisfy the constraint 'object'.
node_modules/@types/core-js/index.d.ts(665,53): error TS2344: Type 'K' does not satisfy the constraint 'object'.
node_modules/@types/core-js/index.d.ts(666,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(680,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(692,5): error TS2687: All declarations of 'value' must have identical modifiers.
node_modules/@types/core-js/index.d.ts(804,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/typescript/lib/lib.es6.d.ts(4199,14): error TS2300: Duplicate identifier 'PropertyKey'.
λμμ es5
λ³κ²½νλ©΄ κΉ¨λν λΉλκ° λ©λλ€.
μ΄ λ¬Έμ κ° μ΄λ»κ² κ·Έλ κ² μμ κ΄μ¬μ λ°μλμ§ μ λͺ¨λ₯΄κ² μ΅λλ€. νμ€ν λ§μ μ¬λλ€μ΄ TSλ₯Ό μ¬μ©νμ¬ ES6μ λμμΌλ‘ νλ €κ³ νκ³ μμΌλ©° μ΄ λ¬Έμ μ λΆλͺν κ²μ λκΉ?
@wyqydsyq core.jsμ ES6μ λͺ¨λ λμΌν μ μλ₯Ό λ§μ΄ μ μν©λλ€. @types/core.jsλ₯Ό ν¬ν¨νμ§ μκ±°λ tsconfigμμ "lib": ["es5", "dom"]μ μ€μ νμμμ€.
μ λ λΉμ·ν κ°λ±μ κ²ͺκ³ μμ΅λλ€.
1>c:\Program Files (x86)\Microsoft SDKs\TypeScript\2.6\lib.es2015.iterable.d.ts(203,11): μ€λ₯ TS2300: λΉλ:μ€λ³΅ μλ³μ 'μ½μ'.1>c:\Program Files (x86)\Microsoft SDKs\TypeScript\2.6\lib.es2015.promise.d.ts(223,13): μ€λ₯ TS2300: λΉλ:μ€λ³΅ μλ³μ 'μ½μ'.1>c:\Program Files (x86)\Microsoft SDKs\TypeScript\2.6\lib.es2015.symbol.wellknown.d.ts(168,11): μ€λ₯ TS2300: λΉλ:μ€λ³΅ μλ³μ 'μ½μ'.1>c:\Program Files (x86)\Microsoft SDKs\TypeScript\2.6\lib.es5.d.ts(1292,11): μ€λ₯ TS2300: λΉλ:μ€λ³΅ μλ³μ 'μ½μ'.1>c:\users\username\node_modules\@types\es6-promise\index.d.ts(11,15): μ€λ₯ TS2300: λΉλ:μ€λ³΅ μλ³μ 'μ½μ'.1>c:\users\username\node_modules\@types\es6-promise\index.d.ts(42,19): μ€λ₯ TS2300: λΉλ:μ€λ³΅ μλ³μ 'μ½μ'.
tsconfig: -
{
"μ»΄νμΌλ¬ μ΅μ
": {
"λμ": "es5",
"λͺ¨λ": "commonjs",
"moduleResolution": "λ
Έλ",
"sourceMap": μ°Έ,
"emitDecoratorMetadata": μ°Έ,
"μ€νμ μΈ λ°μ½λ μ΄ν°": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": μ°Έ,
"suppressImplicitAnyIndexErrors": μ°Έ,
"noStrictGenericChecks": true
}
}
ν¨ν€μ§.Json:
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/common": "~4.3.4",
"@angular/compiler": "~4.3.4",
"@angular/core": "~4.3.4",
"@angular/forms": "~4.3.4",
"@angular/http": "~4.3.4",
"@angular/platform-browser": "~4.3.4",
"@angular/platform-browser-dynamic": "~4.3.4",
"@angular/router": "~4.3.4",
"angular-in-memory-web-api": "~0.3.0",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"zone.js": "^0.8.4"
},
"devDependencies": {
"concurrently": "^3.2.0",
"lite-server": "^2.2.2",
"typescript": "2.6.0",
"canonical-path": "0.0.2",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"@types/node": "^6.0.46",
"@types/jasmine": "2.5.36"
},
"repository": {}
}
npm 5.5.1
λ
Έλ 8.9.1
ν΄κ²° λ°©λ²μ΄ μμ΅λκΉ?
λΉμ·ν λ¬Έμ κ°μμμ΅λλ€. λ΄ tsconfig.json
μμ "skipLibCheck": true
μ compilerOptions
νμΌλ©° λμμ΄ λμμ΅λλ€.
μλ νμΈμ
./node_modules/@types/core-js/index.d.ts:1461:36 - μ€λ₯ TS2339: 'SymbolConstructor' μ νμ 'for' μμ±μ΄ μμ΅λλ€.
1461ν
~~~
../node_modules/@types/core-js/index.d.ts:1465:43 - μ€λ₯ TS2339: μμ± 'hasInstance'κ° 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
1465 const hasInstance: typeof core.Symbol.hasInstance
~ ~ ~
../node_modules/@types/core-js/index.d.ts:1469:50 - μ€λ₯ TS2339: 'isConcatSpreadable' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
1469 const isConcatSpreadable: typeof core.Symbol.isConcatSpreadable;
~ ~ ~ ~
../node_modules/@types/core-js/index.d.ts:1477:38 - μ€λ₯ TS2339: 'SymbolConstructor' μ νμ 'keyFor' μμ±μ΄ μμ΅λλ€.
1477 const keyFor: typeof core.Symbol.keyFor
~ ~
../node_modules/@types/core-js/index.d.ts:1481:37 - μ€λ₯ TS2339: 'Match' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
1481 const μΌμΉ: typeof core.Symbol.match;
~
../node_modules/@types/core-js/index.d.ts:1485:39 - μ€λ₯ TS2339: 'SymbolConstructor' μ νμ 'replace' μμ±μ΄ μμ΅λλ€.
1485 const κ΅μ²΄: typeof core.Symbol.replace;
~ ~
../node_modules/@types/core-js/index.d.ts:1489:38 - μ€λ₯ TS2339: 'κ²μ' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
1489 const κ²μ: typeof core.Symbol.search;
~ ~
../node_modules/@types/core-js/index.d.ts:1493:39 - μ€λ₯ TS2339: 'SymbolConstructor' μ νμ 'species' μμ±μ΄ μμ΅λλ€.
1493 const μ’
: typeof core.Symbol.species;
~ ~
../node_modules/@types/core-js/index.d.ts:1497:37 - μ€λ₯ TS2339: 'SymbolConstructor' μ νμ 'split' μμ±μ΄ μμ΅λλ€.
1497 const λΆν : typeof core.Symbol.split;
~
../node_modules/@types/core-js/index.d.ts:1501:43 - μ€λ₯ TS2339: 'toPrimitive' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
1501 const toPrimitive: typeof core.Symbol.toPrimitive;
~ ~ ~
../node_modules/@types/core-js/index.d.ts:1505:43 - μ€λ₯ TS2339: 'toStringTag' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
1505 const toStringTag: typeof core.Symbol.toStringTag;
~ ~ ~
../node_modules/@types/core-js/index.d.ts:1509:43 - μ€λ₯ TS2339: 'SymbolConstructor' μ νμ 'unscopables' μμ±μ΄ μμ΅λλ€.
1509 const unscopables: typeof core.Symbol.unscopables;
~ ~ ~
../node_modules/@types/core-js/index.d.ts:2272:36 - μ€λ₯ TS2339: 'SymbolConstructor' μ νμ 'for' μμ±μ΄ μμ΅λλ€.
2272
~~~
../node_modules/@types/core-js/index.d.ts:2276:43 - μ€λ₯ TS2339: 'hasInstance' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
2276 const hasInstance: typeof core.Symbol.hasInstance;
~ ~ ~
../node_modules/@types/core-js/index.d.ts:2280:50 - μ€λ₯ TS2339: 'isConcatSpreadable' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
2280
~ ~ ~ ~
../node_modules/@types/core-js/index.d.ts:2288:38 - μ€λ₯ TS2339: 'SymbolConstructor' μ νμ 'keyFor' μμ±μ΄ μμ΅λλ€.
2288 const keyFor: typeof core.Symbol.keyFor;
~ ~
../node_modules/@types/core-js/index.d.ts:2292:37 - μ€λ₯ TS2339: 'Match' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
2292 const μΌμΉ: typeof core.Symbol.match;
~
../node_modules/@types/core-js/index.d.ts:2296:39 - μ€λ₯ TS2339: 'λ체' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
2296 const κ΅μ²΄: typeof core.Symbol.replace;
~ ~
../node_modules/@types/core-js/index.d.ts:2300:38 - μ€λ₯ TS2339: 'κ²μ' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
2300 const κ²μ: typeof core.Symbol.search;
~ ~
../node_modules/@types/core-js/index.d.ts:2304:39 - μ€λ₯ TS2339: 'SymbolConstructor' μ νμ 'species' μμ±μ΄ μμ΅λλ€.
2304 const μ’
: typeof core.Symbol.species;
~ ~
../node_modules/@types/core-js/index.d.ts:2308:37 - μ€λ₯ TS2339: 'SymbolConstructor' μ νμ 'λΆν ' μμ±μ΄ μμ΅λλ€.
2308 const λΆν : typeof core.Symbol.split;
~
../node_modules/@types/core-js/index.d.ts:2312:43 - μ€λ₯ TS2339: 'toPrimitive' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
2312 const toPrimitive: typeof core.Symbol.toPrimitive;
~ ~ ~
../node_modules/@types/core-js/index.d.ts:2316:43 - μ€λ₯ TS2339: 'toStringTag' μμ±μ΄ 'SymbolConstructor' μ νμ μ‘΄μ¬νμ§ μμ΅λλ€.
2316 const toStringTag: typeof core.Symbol.toStringTag;
~ ~ ~
../node_modules/@types/core-js/index.d.ts:2320:43 - μ€λ₯ TS2339: 'SymbolConstructor' μ νμ 'unscopables' μμ±μ΄ μμ΅λλ€.
2320 const unscopables: typeof core.Symbol.unscopables;
~ ~ ~
μ΄κ²μ λ΄κ° μ»λ μ€λ₯μ λλ€
λ΄ tsconfig
{
"compileOnSave": κ±°μ§,
"μ»΄νμΌλ¬ μ΅μ
": {
"baseUrl": "",
"outDir": "./dist/out-tsc",
"sourceMap": μ°Έ,
"μ μΈ": κ±°μ§,
"downlevelIteration": μ°Έ,
"μ€νμ μΈ λ°μ½λ μ΄ν°": true,
"λͺ¨λ": "es6",
"moduleResolution": "λ
Έλ",
"importHelpers": μ°Έ,
"λμ": "es5",
"μ ν루νΈ": [
"node_modules/@types"
],
"lib": [
"μμ€5",
"es2015",
"es2017",
"λ",
"μ€ν¬λ¦½νΈ νΈμ€νΈ"
],
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": μ°Έ,
"strictInjectionParameters": μ°Έ
}
}
λ¬Έμ λ₯Ό ν΄κ²°νλλ‘ λμμ£ΌμΈμ
κ°μ₯ μ μ©ν λκΈ
λΉμ·ν λ¬Έμ κ°μμμ΅λλ€. λ΄
tsconfig.json
μμ"skipLibCheck": true
μcompilerOptions
νμΌλ©° λμμ΄ λμμ΅λλ€.