tnrich
tnrich

Reputation: 8580

How to enable typings from definition file in local project

say I have a project my-components that's organized as follows:

/demo
  index.js
  /componentDemos
/src
  index.js
  /components
    statusBar.js
    toastr.js
    ...etc
  /utils
.tsconfig.json
index.d.ts //all type definitions live here

When I require my-components using npm into another project, I get all the typescript type definitions from the index.d.ts file. However, locally in my own project I don't seem to get the nice auto-complete features within my own .js files.

Am I doing something wrong here?

Upvotes: 0

Views: 25

Answers (1)

tnrich
tnrich

Reputation: 8580

Hmm I am not quite sure why this would be the case, but removing my .tsconfig file did the trick. Maybe someone can explain why that would be?

Here's what the .tsconfig.json looked like:

{
  "compilerOptions": {
      "module": "es2015",
      "lib": [
          "es6"
      ],
      "noImplicitAny": true,
      "noImplicitThis": true,
      "strictNullChecks": true,
      "strictFunctionTypes": false,
      "baseUrl": "./",
      "typeRoots": [
          "./"
      ],
      "types": [],
      "noEmit": true,
      "allowJs": true,
      "forceConsistentCasingInFileNames": true
  },
  "files": [
      "index.d.ts"
  ]
}

Upvotes: 0

Related Questions