Importing types from @types/web package
See original GitHub issueThe @types/web
package typings are published as a lib
– they don’t declare any module, they don’t import or export anything. You can include them using a triple-slash comment, but I don’t think it’s possible to import individual types. It would be helpful to be able to write import type {Element} from "web";
without having to pollute the whole global namespace with every web type.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:15
- Comments:8 (2 by maintainers)
Top Results From Across the Web
@types/web - npm
This module contains the DOM types for the majority of the web APIs used in a web browser. The APIs inside @types/web are...
Read more >Importing TypeScript type from another TypeScript package
In your index.ts, You can do: export { IndexInfoDict } from "./interfaces;. This will export the interface from the main file.
Read more >Documentation - TypeScript 4.5
Template String Types as Discriminants · module es2022 · Tail-Recursion Elimination on Conditional Types · Disabling Import Elision · type Modifiers on Import...
Read more >Enhance imports for TypeScript nested types : WEB-44021
ts and additional files. When such package is listed as dependency in WebStorm and trying to import Type , WebStorm import intent will...
Read more >Announcing TypeScript 4.5 - Microsoft Developer Blogs
... install a specific package to take over for a given lib For example, today TypeScript publishes versions of the DOM APIs on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I could imagine this as another potential export from this repo, its use case is pretty niche though IMO because you don’t want to be including this in an environment which has
dom
added globally because the versions could easily be mismatchedI think it’s very likely that TS could never move away from vending the interfaces globally because of ecosystem breakage, which means you’d have to be quite delicate in how a project using this would be set up
This can help us to unblock https://github.com/DefinitelyTyped/DefinitelyTyped/issues/60924 without needing to duplicate types or re-invent the wheel…