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.

Importing types from @types/web package

See original GitHub issue

The @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:open
  • Created 2 years ago
  • Reactions:15
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ortacommented, Dec 6, 2021

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 mismatched

I 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

1reaction
pirannacommented, Sep 5, 2022

This can help us to unblock https://github.com/DefinitelyTyped/DefinitelyTyped/issues/60924 without needing to duplicate types or re-invent the wheel…

Read more comments on GitHub >

github_iconTop 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 >

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