Files
node-web-globals/README.md
T
2026-02-09 16:29:45 -08:00

23 lines
786 B
Markdown

# Node Web Globals
These types are the global declarations copied (literally) from `@types/web` which have matching symbol names to those in `@types/node/web-globals`, to provide global types that are compatible with both web and node for developing libraries that are compatible with both web and node. Type definitions are provided by `@sugoidogo/importable-web-types`.
# Usage
To prevent tsc from importing the default `Dom` library, add the `compilerOptions` key `lib` with value `ESNext` (or whatever version you're targeting, such as `ES2022`).
```json
// tsconfig.json
{
"compilerOptions":{
"lib":["ESNext"],
"types":["@sugoidogo/node-web-globals"]
}
}
```
```typescript
// main.ts
console.log("Hello World!") // compiles
proces.exit(0) // throws
```