question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create react app typscript does not load d.ts file

See original GitHub issue

Is this a bug report?

No

Did you try recovering your dependencies?

YES

(Write your answer here.) npm --version 6.8.0

Which terms did you search for in User Guide?

(Write your answer here if relevant.)

Environment

Ubuntu

System: OS: Linux 4.4 Ubuntu 16.04.5 LTS (Xenial Xerus) CPU: x64 Intel® Core™ i5-5300U CPU @ 2.30GHz Binaries: Node: 10.0.0 - /usr/local/bin/node npm: 6.8.0 - /usr/local/bin/npm Browsers: Chrome: 72.0.3626.109 Firefox: 65.0 npmPackages: react: ^16.8.3 => 16.8.3 react-dom: ^16.8.3 => 16.8.3 react-scripts: 2.1.5 => 2.1.5 npmGlobalPackages: create-react-app: Not Found

Steps to Reproduce

(Write your steps here:)

I have moved my project into create react app typeascript from a webpack based build structure. It contains all the d.ts files in one folder. When i start my script server . it shows all the declaration in d.ts as ‘X’ interface not found’. Following in my tsconfig file. I am not sure what i am i missing here. { “compilerOptions”: { “target”: “es6”, “lib”: [ “dom”, “es2017” ], “allowJs”: true, “skipLibCheck”: false, “esModuleInterop”: true, “allowSyntheticDefaultImports”: true, “strict”: false, “sourceMap”: true, “forceConsistentCasingInFileNames”: true, “module”: “esnext”, “moduleResolution”: “node”, “resolveJsonModule”: true, “isolatedModules”: true, “noEmit”: true, “jsx”: “preserve”, “pretty”: true, “preserveConstEnums”: true, “typeRoots”: [ “./node_modules/@types”, “src/types/" ] }, “include”: [ "src/” ] }

Expected Behavior

d.ts file should be auto detected by typescript and the definations be aviable to use globally

Actual Behavior

All the declaration in the d.ts files are missing

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
anuragsharma123commented, Mar 22, 2019

Hi ,

I had to mention “src/types/**/*”, specially in my includes in tsconfig.json file and then it was able to detect the d.ts file on its own.

0reactions
stale[bot]commented, Apr 26, 2019

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create react app typescript does not load d.ts file
I have a few d.ts files where I have defined interfaces types and enums. When I run start script. It is not able...
Read more >
Create a declaration file .d.ts file for a npm module does not ...
I am trying to use react-geocode with TypeScript but it does not have @type package. I did following to make it work: eject...
Read more >
Documentation - Modules .d.ts - TypeScript
One style of exporting in CommonJS is to export a function. Because a function is also an object, then extra fields can be...
Read more >
Using React with TypeScript - Mattermost
This usually occurs because tsconfig.json (TypeScript's configuration file) is absent from your project. CRA should generate this for you, but ...
Read more >
Static Type Checking - React
Static type checkers like Flow and TypeScript identify certain types of problems before you ... Only follow this step if you don't use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found