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

i18next 'has no exported member' errors #292

Closed
davidsk opened this Issue Dec 28, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@davidsk
Copy link

davidsk commented Dec 28, 2018

I'm submitting a bug report

  • Library Version:
    3.0.0-beta.4

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    8.11.3

  • NPM Version:
    6.3.0
  • JSPM OR Webpack AND Version
    JSPM 0.16.32 | webpack 2.1.0-beta.17
    Neither, using the new autotracing bundler
  • Browser:
    Chrome 71.0.3578.98

  • Language:
    TypeScript 2.9.2

Current behavior:
Several 'has not exported member' errors generated during typescript compilation

Expected/desired behavior:
No type definition errors generated during typescript compilation.

  • What is the expected behavior?
    No type definition errors generated during typescript compilation

  • What is the motivation / use case for changing the behavior?
    No 'red herrings' during development

  • Additional info
    Substituting

import * as i18next from 'i18next';

with

import i18next from 'i18next';

in the aurelia-i18n.d.ts file seems to fix the problem.

@davidsk

This comment has been minimized.

Copy link

davidsk commented Dec 28, 2018

Sample project: https://github.com/davidsk/Aurelia-i18n_292

C:/temp/Aurelia-i18n_292> npm install
*** npm output removed ***
C:/temp/Aurelia-i18n_292> au run
Starting 'readProjectConfiguration'...
Finished 'readProjectConfiguration'
Starting 'processMarkup'...
Starting 'processCSS'...
Starting 'copyFiles'...
Starting 'configureEnvironment'...
Finished 'copyFiles'
Finished 'processCSS'
Finished 'processMarkup'
Finished 'configureEnvironment'
Starting 'buildTypeScript'...
C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n.d.ts(8,57): error TS2694: Namespace '"C:/temp/Aurel
ia-i18n_292/node_modules/i18next/index"' has no exported member 'InitOptions'.
[21:12:15] gulp-notify: [Error running Gulp] Error: C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n
.d.ts(8,57): error TS2694: Namespace '"C:/temp/Aurelia-i18n_292/node_modules/i18next/index"' has no exported member 'Ini
tOptions'.
C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n.d.ts(12,57): error TS2694: Namespace '"C:/temp/Aure
lia-i18n_292/node_modules/i18next/index"' has no exported member 'i18n'.
[21:12:15] gulp-notify: [Error running Gulp] Error: C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n
.d.ts(12,57): error TS2694: Namespace '"C:/temp/Aurelia-i18n_292/node_modules/i18next/index"' has no exported member 'i1
8n'.
C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n.d.ts(29,51): error TS2694: Namespace '"C:/temp/Aure
lia-i18n_292/node_modules/i18next/index"' has no exported member 'InitOptions'.
[21:12:15] gulp-notify: [Error running Gulp] Error: C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n
.d.ts(29,51): error TS2694: Namespace '"C:/temp/Aurelia-i18n_292/node_modules/i18next/index"' has no exported member 'In
itOptions'.
C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n.d.ts(31,45): error TS2694: Namespace '"C:/temp/Aure
lia-i18n_292/node_modules/i18next/index"' has no exported member 'TranslationFunction'.
[21:12:15] gulp-notify: [Error running Gulp] Error: C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n
.d.ts(31,45): error TS2694: Namespace '"C:/temp/Aurelia-i18n_292/node_modules/i18next/index"' has no exported member 'Tr
anslationFunction'.
C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n.d.ts(36,47): error TS2694: Namespace '"C:/temp/Aure
lia-i18n_292/node_modules/i18next/index"' has no exported member 'TranslationOptions'.
[21:12:15] gulp-notify: [Error running Gulp] Error: C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n
.d.ts(36,47): error TS2694: Namespace '"C:/temp/Aurelia-i18n_292/node_modules/i18next/index"' has no exported member 'Tr
anslationOptions'.
C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n.d.ts(173,39): error TS2694: Namespace '"C:/temp/Aur
elia-i18n_292/node_modules/i18next/index"' has no exported member 'TranslationOptions'.
[21:12:15] gulp-notify: [Error running Gulp] Error: C:/temp/Aurelia-i18n_292/node_modules/aurelia-i18n/dist/aurelia-i18n
.d.ts(173,39): error TS2694: Namespace '"C:/temp/Aurelia-i18n_292/node_modules/i18next/index"' has no exported member 'T
ranslationOptions'.
TypeScript: 6 semantic errors
...
@zewa666

This comment has been minimized.

Copy link
Member

zewa666 commented Dec 29, 2018

@bigopon remember that you added the fix for the star import? Was there a specific reason? Guess because of tsconfig settings right?

@bigopon

This comment has been minimized.

Copy link
Member

bigopon commented Dec 29, 2018

i18next used to be distributed without a type definition with it, and in its separate typing package at @types/i18next, the main typing i18next was exported as a module. Since version 12, it seems this has been changed. Now it's a default export. Checking both versions 13 and 12 of i18next, I think it's safe to change the generated code to

import i18next from 'i18next';

from

import * as i18next from 'i18next';

as it seems this is the way to go.

@zewa666

This comment has been minimized.

Copy link
Member

zewa666 commented Dec 29, 2018

Alright, last but not least can you provide us your tsconfig.json contents @davidsk, just to make sure there are no special setups in place

@davidsk

This comment has been minimized.

Copy link

davidsk commented Dec 29, 2018

Sure. It was created via the CLI and I haven't edited it so I imagine it's pretty standard.

{
  "compileOnSave": false,
  "compilerOptions": {
    "sourceMap": true,
    "target": "es5",
    "module": "amd",
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowJs": true,
    "moduleResolution": "node",
    "lib": ["es2017", "dom"],
    "baseUrl": "src"
  },
  "include": [
    "./src/**/*.ts",
    "./test/**/*.ts",
    "./custom_typings/**/*.d.ts"
  ],
  "atom": {
    "rewriteTsconfig": false
  }
}
@zewa666

This comment has been minimized.

Copy link
Member

zewa666 commented Dec 29, 2018

Thanks for the feedback. I've merged the PR to fix this. Will be available with the next release

@zewa666 zewa666 closed this Dec 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment