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.

TypeScript: How to setup external module type definition like @types

See original GitHub issue

In the following section in the TypeScript guide explaining how to apply d.ts file that’s you have already.

But person who are familiar Node.js’s npm package like me, execute command like npm install -D @types/react and then get type definition file from DefinitelyTyped.

As a one of React/Node.js developer, current manual seems like unclear to get type definition file of external modules.

I think it’s better if the manual is covering that concern clearly.

Thank you. 🤗

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kitsonkcommented, Aug 1, 2021

The issue is tagged as help wanted to indicate that the community could contribute to making the documentation more clear by adding to the TypeScript FAQ section.

1reaction
kitsonkcommented, Jul 24, 2021

There is this section which talks about CDNs that can provide types automatically.

A more clear FAQ though could provide both pieces of information at the same time, noting that most code target for Deno is either written in TypeScript or automatically provides its types, so the type acquisition is really the concern when trying to leverage code written for Node.js or on npm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript: Adding Custom Type Definitions for Existing ...
Initial Setup. Before you write custom types, you need to tell the transpiler about them. To do this you should edit the tsconfig.json...
Read more >
Documentation - Modules .d.ts
Create a new folder in node_modules/@types/[libname] · Create an index.d.ts in that folder, and copy the example in · See where your usage...
Read more >
Add your own Type Definition to any Javascript 3rd party ...
Step 3 : · 1. To the typeRoots property add your local-types folder path. "compilerOptions" : { ... "typeRoots": [ "node_modules/@types", · 2....
Read more >
Adding Custom Type Definitions to a Third-Party Library
Try npm install @types/third-party-library-name if it exists or add a new declaration (.d.ts) file containing declare module ...
Read more >
Typescript Typings: The Complete Guide: @types Compiler ...
Why do I sometimes get a 'duplicate type definition' error, and how to fix it? Why does it look like Promise type definitions...
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