Skip to content

TypeScript Doesn't Read Type Definition Files? #316

Closed Answered by cemalgnlts
cemalgnlts asked this question in Q&A
Discussion options

You must be logged in to vote

I found a strange solution. The folder structure should be like this:

node_modules/
└── logger/
    ├── dist/
    │   └── logger.d.ts
    ├── index.js
    └── package.json

package.json should be like this:

{
  "name": "logger",
  "version": "1.0.0",
  "types": "./dist/logger.d.ts"
}

There must be a dist folder, the name of the type file must be the same as the package file.

I also found out why you don't detect semantic errors. I changed the typescript.tsserver.web.projectWideIntellisense.suppressSemanticErrors setting to false and now autocomplete works and semantic errors are also shown.

Thanks!

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@CGNonofr
Comment options

@cemalgnlts
Comment options

@CGNonofr
Comment options

@cemalgnlts
Comment options

Answer selected by cemalgnlts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants