@@ -1,21 +1,23 @@
|
||||
# Node Web Globals
|
||||
|
||||
These types are copied (literally) from the web-globals folder of `@types/node` to provide types that are compatible with both web and node for developing libraries that are compatible with both web and node.
|
||||
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`).
|
||||
|
||||
<details><summary>tsconfig.json</summary>
|
||||
|
||||
```json
|
||||
// tsconfig.json
|
||||
{
|
||||
"compilerOptions":{
|
||||
"module":"esnext",
|
||||
"moduleResolution":"node",
|
||||
"lib":["ESNext"]
|
||||
"lib":["ESNext"],
|
||||
"types":["@sugoidogo/node-web-globals"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
```typescript
|
||||
// main.ts
|
||||
console.log("Hello World!") // compiles
|
||||
proces.exit(0) // throws
|
||||
```
|
||||
Reference in New Issue
Block a user