Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error TS2440: Import declaration conflicts with local declaration of 'AccessScope' #537

Closed
george-ayris opened this issue Nov 6, 2019 · 8 comments · Fixed by #538
Closed

Comments

@george-ayris
Copy link

I'm submitting a bug report

  • Library Version:
    1.5.0

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    10.8.0

  • NPM Version:
    6.2.0
  • JSPM OR Webpack AND Version
    Actually still using gulp v4.0.0 from old way to setup aurelia-cli build
  • Language:
    TypeScript 3.7

Current behavior:
Since upgrading to TypeScript 3.7, I am getting the following error during transpilation:
node_modules/aurelia-validation/dist/aurelia-validation.d.ts(1,37): error TS2440: Import declaration conflicts with local declaration of 'AccessScope'.

If I comment out https://github.com/aurelia/validation/blob/master/dist/aurelia-validation.d.ts#L505 the transpilation works (though obviously that's not an actual solution).

Expected/desired behavior:
TypeScript 3.7 transpilation to work.

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "sourceMap": true,
    "target": "es5",
    "module": "amd",
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "downlevelIteration": true,
    "moduleResolution": "node",
    "lib": ["es2019", "dom"],
    "baseUrl": "./src",
    "paths": {
      "@azure/storage-blob": ["../lib/azure-storage.blob.min.js"],
      "*": ["*", "../*"]
    }
  },
  "exclude": [
    "node_modules",
    "aurelia_project"
  ],
  "filesGlob": [
    "./src/**/*.ts",
    "./test/**/*.ts",
    "./custom_typings/**/*.d.ts"
  ],
  "atom": {
    "rewriteTsconfig": false
  }
}

package.json

{
  "name": "web",
  "description": "An Aurelia client application.",
  "version": "0.1.0",
  "repository": {
    "type": "???",
    "url": "???"
  },
  "license": "MIT",
  "dependencies": {
    "@aspnet/signalr": "^1.1.4",
    "@types/bootstrap": "^4.3.0",
    "@types/daterangepicker": "^3.0.1",
    "applicationinsights-js": "1.0.8",
    "aurelia-animator-css": "^1.0.1",
    "aurelia-bootstrapper": "^2.3.1",
    "aurelia-dialog": "^2.0.0-rc.3",
    "aurelia-fetch-client": "^1.7.0",
    "aurelia-store": "^1.3.1",
    "aurelia-validation": "^1.5.0",
    "bluebird": "^3.5.3",
    "bootstrap": "^4.3.1",
    "bootstrap-select": "^1.13.10",
    "daterangepicker": "^3.0.3",
    "highcharts": "^7.0.0",
    "jquery": "^3.3.1",
    "moment": "^2.22.1",
    "popper.js": "^1.14.6",
    "requirejs": "^2.3.6",
    "text": "github:requirejs/text#latest",
    "ts-keycode-enum": "^1.0.6"
  },
  "peerDependencies": {},
  "devDependencies": {
    "@types/applicationinsights-js": "^1.0.9",
    "@types/bootstrap-select": "^1.11.1",
    "@types/jest": "^23.3.10",
    "@types/node": "^12.12.6",
    "aurelia-cli": "^1.0.0-beta.7",
    "aurelia-pal-nodejs": "^1.2.0",
    "aurelia-testing": "^1.0.0",
    "aurelia-tools": "^2.0.0",
    "browser-sync": "^2.26.3",
    "connect-history-api-fallback": "^1.2.0",
    "event-stream": "^4.0.1",
    "gulp": "github:gulpjs/gulp#v4.0.0",
    "gulp-changed-in-place": "^2.0.3",
    "gulp-notify": "^3.2.0",
    "gulp-plumber": "^1.2.1",
    "gulp-rename": "^1.2.2",
    "gulp-replace": "^1.0.0",
    "gulp-sass": "^4.0.2",
    "gulp-sourcemaps": "^2.0.0-alpha",
    "gulp-tslint": "^8.1.3",
    "gulp-typescript": "^5.0.0",
    "jest": "^23.6.0",
    "jest-cli": "^23.6.0",
    "jest-teamcity-reporter": "^0.9.0",
    "minimatch": "^3.0.2",
    "node-fetch": "^2.3.0",
    "through2": "^3.0.0",
    "ts-jest": "^23.10.5",
    "tslint": "^5.11.0",
    "typescript": "^3.7.2",
    "uglify-js": "^3.4.9",
    "vinyl-fs": "^3.0.3"
  },
  "scripts": {
    "test": "jest --verbose"
  }
}

Thanks!

@woksin
Copy link

woksin commented Dec 3, 2019

A bug fix introduced in TypeScript 3.7 seems to be the cause of the issues here under the 'Local and Imported Type Declarations Now Conflict' section:
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#local-and-imported-type-declarations-now-conflict

@ben-girardet
Copy link
Contributor

I confirm the bug and the new TypeScript 3.7 release that now error when there is a conflict between import and export.

In this package, the AccessScope get exported as any here:

export type AccessScope = any;

And is imported from aurelia-binding in several occasions such as:

When compiling the export and import get mixed in the declaration, which result in the error mentioned above:

https://github.com/aurelia/validation/blob/86ed521136956cae33844d2dad945f3f98a06831/dist/aurelia-validation.d.ts

~~

Now when I look at the expression-visitor.ts (link) file, I see that the AccessScope (and many more variables) have been commented out from the import .... from 'aurelia-binding and redeclare as any for some reason that I don't understand.

Can someone explain the reason behind this redeclaration as any ?

@ben-girardet
Copy link
Contributor

@jdanyow @EisenbergEffect

Thanks @jdanyow for merging #538

Anything prevent now from publishing on NPM ?
Only then this issue will be closed and people will be able to build projects with Typescript 3.7.

Thanks 👍

@EisenbergEffect
Copy link
Contributor

@ben-girardet We'll get this released in the next few days. Apologies for the delay. It won't be much longer.

@ben-girardet
Copy link
Contributor

thanks @EisenbergEffect
No need to apologize. Thankful for your job.

@EisenbergEffect
Copy link
Contributor

@ben-girardet I'm still seeing some issues with building the latest code. I'm investigating now but this may take a bit longer.

@EisenbergEffect
Copy link
Contributor

Got a couple issues resolved. @bigopon is looking into one other. Once that's all resolved, I should be able to get this out right away. Again, thanks for your patience!

@bigopon
Copy link
Member

bigopon commented Dec 17, 2019

@EisenbergEffect @ben-girardet I've fixed this issue at #539

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants