Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Typescript imports cannot work correctly with typescript definition files #294

Open
kestred opened this issue Mar 23, 2018 · 1 comment
Open

Comments

@kestred
Copy link

kestred commented Mar 23, 2018

Using electron-prebuilt-compile, typescript does not correctly support default imports.

I had expected that this would work:
import Vue from 'vue';
but, it returns undefined.

Using import Vue as * from 'vue'; works, however it is incompatible with typescript linters and the typescript compiler itself would refuse to compile the same code (b.c. of type errors).


I had assumed that it was an issue with the _compilerc and tsconfig.json files, however after trying every variation that I could find, I've given up on solving it through configuration.

Here are two example configs, both which do not appear to work:

{
  "compilerOptions": {
    // this aligns with Vue's browser support
    "target": "es5",
    // this enables stricter inference for data properties on `this`
    "strict": true,
    // if using webpack 2+ or rollup, to leverage tree shaking:
    "module": "es2015",
    "moduleResolution": "node"
  }
}

and

  "compilerOptions": {
        "removeComments": false,
        "preserveConstEnums": true,
        "sourceMap": true,
        "declaration": true,
        "noImplicitAny": true,
        "noImplicitReturns": true,
        "suppressImplicitAnyIndexErrors": true,
        "strictNullChecks": true,
        "noUnusedLocals": true,
        "noImplicitThis": true,
        "noUnusedParameters": true,
        "importHelpers": true,
        "noEmitHelpers": true,
        "module": "commonjs",
        "moduleResolution": "node",
        "pretty": true,
        "target": "es2015",
        "typeRoots": ["./types"]
},
@justinneff
Copy link

Did anyone figured out the correct way to configure compilerc to correct this problem?

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

Successfully merging a pull request may close this issue.

2 participants