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.

Support searching for package types TypeScript / Flow

See original GitHub issue

Allow to search for main entry types file from package.json if exists, or link to definitelytyped if exists

Candidates for keywords

  • ~t not available (list of git tags)~
  • dt from definitelytyped
  • dts from *.d.ts
  • ts typescript types *.ts
  • ft flow typed
  • flow flow types *.flow
  • types for both TypeScript and Flow, but better to have them separated

Think would be better to have different keywords for TypeScript and Flow

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
iamandrewlucacommented, Nov 18, 2020

You are killing all my PR’s 😄

Actually I did not thought to search for njt @types/PACKAGE. It makes sense. Thanks for making this clear to me I think this can be closed.

Thanks again for njt 🙂

I’ll go and add a OpenSearch definition for https://www.typescriptlang.org/dt/search?search=

0reactions
kachkaevcommented, Nov 18, 2020

And a lot of times I’m searching for types for a package

How do you do this without njt? At what stage and what for?

My workflow:

  1. Add a package I’m interested in

  2. Add an import into one of my project files

  3. If autocompletion kicks in, typings are there so I don’t need to do anything. If VSCode highlights the first character of the import with a dashed line, this means that the package missing the typings. In that case, I do njt @types/PACKAGE, take a quick glance at the number of weekly downloads and yarn add -D @types/PACKAGE.

  4. If I need to refer to a typing of a particular package resource, I command+click on the symbol and get straight to a corresponding .d.ts file in node_modules. No need to manually navigate to the package repo or explore the @types/PACKAGE folder on GitHub.

If the presence of typings affects the decision to install a package, then https://www.typescriptlang.org/dt/search is the tool to check. If a package is found, typings are available. A hexagon icon means that they are built in, a square with DT in it means that the typings are in DefinietelyTyped repo.

If you still believe that there is scope for a new feature in njt, happy to discuss the added value, the use cases and the spec. Note that adding keywords of 2+ chars affects the simplicity of the tool, so this leap needs to be really well justified.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support for TypeScript definition files · Issue #7 · facebook/flow
I've been thinking about creating a bot that would send PR's to npm packages with both Flow and TypeScript type definitions, with instructions ......
Read more >
Documentation - ECMAScript Modules in Node.js - TypeScript
Node.js supports a new setting in package.json called type . "type" can be set to either "module" or "commonjs" . ... This setting...
Read more >
Documentation - Type Declarations - TypeScript
TypeScript automatically finds type definitions under node_modules/@types , so there's no other step needed to get these types available in your program. Your ......
Read more >
Documentation - TypeScript 4.7
Node.js supports a new setting in package.json called type . ... Under the mode "auto" , TypeScript will not only look for import...
Read more >
Documentation - Module Resolution - TypeScript
These strategies tell the compiler where to look for moduleA . ... TypeScript will also use a field in package.json named types to...
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