I am using @types/core-js 0.9.34. I am getting the following error. This is the statement i had it in the tsconfig.json file
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib": ["es5","dom"],
"moduleResolution": "node",
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"typeRoots": [ "node_modules/@types" ]
},
"exclude": [
"node_modules",
"typings/browser.d.ts",
"typings/browser/"
],
"compileOnSave": false,
"filesGlob": [
"public/.ts",
"public//.ts"
]
}
when I compile it i am getting the following error: node_modules/@types/core-js/index.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'. The typescript version I have used is :"typescript": "2.0.10"
Please give me an idea how to rectify the issue
Try using a newer version of @types/core-js.
I tried with latest version 0.9.37. it also shows the breaks in the build with the following errors:
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(8,14): error TS2300: Duplicate identifier 'PropertyKey'.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(12,5): error TS2687: All declarations of 'value' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(250,5): error TS2687: All declarations of 'EPSILON' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(285,5): error TS2687: All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(292,5): error TS2687: All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(348,5): error TS2687: All declarations of 'flags' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(500,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(563,5): error TS2687: All declarations of 'size' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(572,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(583,5): error TS2687: All declarations of 'size' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(592,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(607,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(621,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
__lib/lib.es2015.core.d.ts(17,14): error TS2300: Duplicate identifier 'PropertyKey'.
My tsconifg.json:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"lib": ["es2015","dom"],
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"types": [
"core-js"
]
},
"exclude": [
"node_modules",
"typings/browser.d.ts",
"typings/browser/"
],
"compileOnSave": false,
"filesGlob": [
"public/.ts",
"public//.ts"
]
}
please give me an idea how to rectify it?
Also with the previous version 0.9.34 I have tried with the following code:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib": ["es5","dom"],
"moduleResolution": "node",
"noLib": true,
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"typeRoots": [
"node_modules/@types"
],
"types": [
"core-js"
]
},
"exclude": [
"node_modules/",
"typings/browser.d.ts",
"typings/"
],
"compileOnSave": false,
"filesGlob": [
"public/.ts",
"public//.ts"
]
}
I am able to clear the gulp errors but i come across with the following errors given below:
error TS2318: Cannot find global type 'Boolean'.
error TS2318: Cannot find global type 'IArguments'.
I searched with this errors but could not able to find the solution
Your compile errors are in es6-shim, not in core-js. We may have to do work similar to #15108 on that. @rbuckton
@andy-ms : based on your suggestion I have changed the following lines in tsconfig.json:
I have pointed the lib-es6 and target to es5
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib":["es6","dom"],
"moduleResolution": "node",
"noLib": true,
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"typeRoots": [
"node_modules/@types"
],
"types": [
"core-js"
]
},
"exclude": [
"node_modules",
"typings/browser.d.ts",
"typings/browser/"
],
"compileOnSave": false,
"filesGlob": [
"public/.ts",
"public//.ts"
]
}
After compiling I am able to remove the es6-shim error but i am getting the following error.
error TS2318: Cannot find global type 'Boolean'.
error TS2318: Cannot find global type 'IArguments'.
Please let me know what causes this error?
Try removing "noLib": true. That option removes important declarations.
@andy-ms
when i tried removing the "noLib": true, I am getting the following errors:
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(8,14): error TS2300: Duplicate identifier 'PropertyKey'.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(12,5): error TS2687: All declarations of 'value' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(250,5): error TS2687: All declarations of 'EPSILON' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(285,5): error TS2687: All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(292,5): error TS2687: All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(348,5): error TS2687: All declarations of 'flags' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(500,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(563,5): error TS2687: All declarations of 'size' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(572,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(583,5): error TS2687: All declarations of 'size' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(592,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(607,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
/var/www/html/wildoystermaster/typings/browser/ambient/es6-shim/index.d.ts(621,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
__lib/lib.es2015.core.d.ts(17,14): error TS2300: Duplicate identifier 'PropertyKey'.
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(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.
@andy-ms
can you please tell me which are all the statements to be included in tsconfig.json?
@andy-ms
Finally I have fixed it by removing the @types/core-js file and making use of the generic core-js file.
Also downgrading the angular2- tree-component module. Thank you for your inputs and suggestions
Sorry for digging this out, but have similar problem, with @types/core-js 0.9.35.
Building Angular 2 app with grunt:
`module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
src: ['/.js'],
dest: 'src/<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '/! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> /\n'
},
dist: {
files: {
'src/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
}
}
},
watch: {
scripts: {
files: 'src//.ts',
tasks: ['ts'],
options: {
event: ['all'],
reload: true
},
},
css: {
files: '/.less',
tasks: ['lessc'],
options: {
event: ['all'],
reload: true
},
}
},
ts: {
default: {
src: ["/.ts", "!node_modules/*/.ts"]
}
},
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
files: [{
src: ['src/main.css'],
dest: 'src/<%= pkg.name %>.min.css'
}]
}
},
less: {
development: {
options: {
paths: ['src/']
},
files: {
'src/main.css': ['src/main.less' /, './app/app.component.less'/ ]
}
},
production: {
options: {
paths: ['src/'],
},
files: {
'src/main.css': ['src/main.less' /, './app/app.component.less'/ ]
}
}
}
});
//grunt.loadNpmTasks('grunt-contrib-uglify');
//grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-ts');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('default', ['less', 'cssmin', 'ts', 'concat']);
};`
Here's my package.json:
{
"name": "some-test-app",
"version": "0.0.1",
"license": "MIT",
"scripts": {},
"private": true,
"dependencies": {
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/forms": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
"core-js": "^2.4.1",
"less": "^2.7.3",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"grunt": "1.0.1",
"grunt-ts": "6.0.0-beta.17",
"grunt-contrib-less": "1.4.0",
"grunt-contrib-cssmin": "2.2.0",
"grunt-contrib-concat": "1.0.0",
"grunt-contrib-uglify": "3.3.0",
"grunt-contrib-watch": "1.0.0",
"@types/core-js": "0.9.35",
"@types/node": "^8.5.0",
"ts-node": "1.2.1",
"tslint": "^4.0.0",
"typescript": "~2.2.2"
}
}
and tsconfig.json:
{
"compilerOptions": {
"alwaysStrict": true,
"downlevelIteration": true,
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["dom", "es6"],
"mapRoot": "./",
"module": "amd",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"removeComments": true,
"sourceMap": true,
"target": "es6",
"typeRoots": [
"../node_modules/@types"
]
}
}
And when I run grunt, I get:
`Using tsc v2.2.2
node_modules/@types/node/index.d.ts(79,14): error TS2687: All declarations of 'iterator' must have identical modifiers.
src/app/app.component.ts(8,14): error TS1219: Experimental support for decorators is a feature that is subject tochange in a future release. Set the 'experimentalDecorators' option to remove this warning.
src/app/app.module.ts(20,14): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
2 syntax errors 1 non-emit-preventing type warning
Error: tsc return code: 2
Warning: Task "ts:default" failed. Use --force to continue.
Aborted due to warnings.`
And it's that code bit fault:
interface IteratorResult<T> { }
interface SymbolConstructor {
readonly iterator: symbol;
}
Tried using different module in tsconfig.json, like "commonjs", or "amd"; added "es2015.iterable" to lib array inside compilerOptions, nothing changed, changed @types/node to 8.5.2, nope, didn't worked.
Bug inside @types/node ?