Skip to content

Commit af40c10

Browse files
committed
Adds 4.5 READMEs, and makes the files match up to the versions in the spec
1 parent c7f8137 commit af40c10

File tree

6 files changed

+48
-10
lines changed

6 files changed

+48
-10
lines changed

deploy/createTypesPackages.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const packages = [
1717
readme: "./readmes/web.md",
1818
files: [
1919
{ from: "../generated/dom.generated.d.ts", to: "index.d.ts" },
20-
{ from: "../generated/dom.iterable.generated.d.ts", to: "index.iterable.d.ts", autoImport: true },
20+
{ from: "../generated/dom.iterable.generated.d.ts", to: "iterable.d.ts", autoImport: true },
2121
],
2222
},
2323
{
@@ -26,7 +26,7 @@ export const packages = [
2626
readme: "./readmes/serviceworker.md",
2727
files: [
2828
{ from: "../generated/serviceworker.generated.d.ts", to: "index.d.ts" },
29-
{ from: "../generated/serviceworker.iterable.generated.d.ts", to: "index.iterable.d.ts", autoImport: true },
29+
{ from: "../generated/serviceworker.iterable.generated.d.ts", to: "iterable.d.ts", autoImport: true },
3030
],
3131
},
3232
{
@@ -35,7 +35,7 @@ export const packages = [
3535
readme: "./readmes/audioworklet.md",
3636
files: [
3737
{ from: "../generated/audioworklet.generated.d.ts", to: "index.d.ts" },
38-
{ from: "../generated/audioworklet.iterable.generated.d.ts", to: "index.iterable.d.ts", autoImport: true },
38+
{ from: "../generated/audioworklet.iterable.generated.d.ts", to: "iterable.d.ts", autoImport: true },
3939
],
4040
},
4141
{
@@ -44,7 +44,7 @@ export const packages = [
4444
readme: "./readmes/sharedworker.md",
4545
files: [
4646
{ from: "../generated/sharedworker.generated.d.ts", to: "index.d.ts" },
47-
{ from: "../generated/sharedworker.iterable.generated.d.ts", to: "index.iterable.d.ts", autoImport: true },
47+
{ from: "../generated/sharedworker.iterable.generated.d.ts", to: "iterable.d.ts", autoImport: true },
4848
],
4949
},
5050
];

deploy/readmes/audioworklet.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ To use `@types/audioworklet` you need to do two things:
1818

1919
That's all.
2020

21+
If you'd like to ensure that the DOM types are never accidentally included, you can use [@orta/types-noop]()https://www.npmjs.com/package/@orta/type-noops) in TypeScript 4.5+.
2122

2223
## SemVer
2324

deploy/readmes/serviceworker.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ To use `@types/serviceworker` you need to do two things:
1818

1919
That's all.
2020

21+
If you'd like to ensure that the DOM types are never accidentally included, you can use [@orta/types-noop]()https://www.npmjs.com/package/@orta/type-noops) in TypeScript 4.5+.
2122

2223
## SemVer
2324

deploy/readmes/sharedworker.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ This package contains type definitions which will set up the global environment
1111
To use `@types/sharedworker` you need to do two things:
1212

1313
1. Install the dependency: `npm install @types/sharedworker --save-dev`, `yarn add @types/sharedworker --dev` or `pnpm add @types/sharedworker --dev`.
14+
1415
1. Update your [`tsconfig.json`](https://www.typescriptlang.org/tsconfig) to avoid clashing with the DOM APIs. There are two cases to consider depending on if you have `lib` defined in your `tsconfig.json` or not.
1516

1617
1. **Without "lib"** - You will need to add `"lib": []`. The value you want to add inside your lib should correlate to your [`"target"`](https://www.typescriptlang.org/tsconfig#target). For example if you had `"target": "es2017"`, then you would add `"lib": ["es2017"]`
1718
1. **With "lib"** - You should remove `"dom"`.
1819

19-
That's all.
2020

21+
If you'd like to ensure that the DOM types are never accidentally included, you can use [@orta/types-noop]()https://www.npmjs.com/package/@orta/type-noops) in TypeScript 4.5+.
2122

2223
## SemVer
2324

deploy/readmes/web.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ The APIs inside `@types/web` are [generated from](https://github.com/microsoft/T
88

99
## Installation
1010

11+
With TypeScript 4.5+ using [lib replacement](https://github.com/microsoft/TypeScript/pull/45771), you can swap the DOM lib with this dependency:
12+
13+
```sh
14+
pnpm add @typescript/lib-dom@npm:@types/web --save-dev
15+
npm install @typescript/lib-dom@npm:@types/web --save-dev
16+
yarn add @typescript/lib-dom@npm:@types/web --dev
17+
```
18+
19+
That's all.
20+
21+
<details>
22+
<summary>TypeScript 4.4 and below</summary>
23+
24+
<br/>
1125
To use `@types/web` you need to do two things:
1226

1327
1. Install the dependency: `npm install @types/web --save-dev`, `yarn add @types/web --dev` or `pnpm add @types/web --dev`.
@@ -17,7 +31,10 @@ To use `@types/web` you need to do two things:
1731
1. **Without "lib"** - You will need to add `"lib": []`. The value you want to add inside your lib should correlate to your [`"target"`](https://www.typescriptlang.org/tsconfig#target). For example if you had `"target": "es2017"`, then you would add `"lib": ["es2017"]`
1832
1. **With "lib"** - You should remove `"dom"`.
1933

20-
That's all.
34+
Removing `"dom"` gives @types/web the chance to provide the same set of global declarations. However, It's possible that your dependencies pull in the TypeScript DOM library, in which case you can either try to make that not happen, or use TypeScript 4.5 to systematically replace the library.
35+
36+
</details>
37+
2138

2239
## SemVer
2340

deploy/readmes/webworker.md

+22-4
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,34 @@ This package contains type definitions which will set up the global environment
88

99
## Installation
1010

11+
With TypeScript 4.5+ using [lib replacement](https://github.com/microsoft/TypeScript/pull/45771), you can swap the WebWorker lib with this dependency:
12+
13+
```sh
14+
pnpm add @typescript/lib-webworker@npm:@types/webworker --save-dev
15+
npm install @typescript/lib-webworker@npm:@types/webworker --save-dev
16+
yarn add @typescript/lib-webworker@npm:@types/webworker --dev
17+
```
18+
19+
That's all.
20+
21+
<details>
22+
<summary>TypeScript 4.4 and below</summary>
23+
24+
<br/>
1125
To use `@types/webworker` you need to do two things:
1226

13-
1. Install the dependency: `npm install @types/webworker --save-dev`, `yarn add @types/webworker --dev` or `pnpm add @types/webworker --dev`.
14-
1. Update your [`tsconfig.json`](https://www.typescriptlang.org/tsconfig) to avoid clashing with the DOM APIs. There are two cases to consider depending on if you have `lib` defined in your `tsconfig.json` or not.
27+
1. Install the dependency: `npm install @types/webworker --save-dev`, `yarn add @types/webworker --dev` or `pnpm add @types/webworker --save-dev`.
28+
29+
1. Update your [`tsconfig.json`](https://www.typescriptlang.org/tsconfig). There are two cases to consider depending on if you have `lib` defined in your `tsconfig.json` or not.
1530

1631
1. **Without "lib"** - You will need to add `"lib": []`. The value you want to add inside your lib should correlate to your [`"target"`](https://www.typescriptlang.org/tsconfig#target). For example if you had `"target": "es2017"`, then you would add `"lib": ["es2017"]`
17-
1. **With "lib"** - You should remove `"dom"`.
32+
1. **With "lib"** - You should remove `"webworker"`.
1833

19-
That's all.
34+
Removing `"webworker"` gives @types/webworker the chance to provide the same set of global declarations. However, It's possible that your dependencies pull in the TypeScript Web Worker library, in which case you can either try to make that not happen, or use TypeScript 4.5 to systematically replace the library.
35+
36+
</details>
2037

38+
If you'd like to ensure that the DOM types are never accidentally included, you can use [@orta/types-noop]()https://www.npmjs.com/package/@orta/type-noops) in TypeScript 4.5+.
2139

2240
## SemVer
2341

0 commit comments

Comments
 (0)