Skip to content

Adds 4.5 READMEs, and makes the files match up to the versions in the… #1161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions deploy/createTypesPackages.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const packages = [
readme: "./readmes/web.md",
files: [
{ from: "../generated/dom.generated.d.ts", to: "index.d.ts" },
{ from: "../generated/dom.iterable.generated.d.ts", to: "index.iterable.d.ts", autoImport: true },
{ from: "../generated/dom.iterable.generated.d.ts", to: "iterable.d.ts", autoImport: true },
],
},
{
Expand All @@ -26,7 +26,7 @@ export const packages = [
readme: "./readmes/serviceworker.md",
files: [
{ from: "../generated/serviceworker.generated.d.ts", to: "index.d.ts" },
{ from: "../generated/serviceworker.iterable.generated.d.ts", to: "index.iterable.d.ts", autoImport: true },
{ from: "../generated/serviceworker.iterable.generated.d.ts", to: "iterable.d.ts", autoImport: true },
],
},
{
Expand All @@ -35,7 +35,7 @@ export const packages = [
readme: "./readmes/audioworklet.md",
files: [
{ from: "../generated/audioworklet.generated.d.ts", to: "index.d.ts" },
{ from: "../generated/audioworklet.iterable.generated.d.ts", to: "index.iterable.d.ts", autoImport: true },
{ from: "../generated/audioworklet.iterable.generated.d.ts", to: "iterable.d.ts", autoImport: true },
],
},
{
Expand All @@ -44,7 +44,7 @@ export const packages = [
readme: "./readmes/sharedworker.md",
files: [
{ from: "../generated/sharedworker.generated.d.ts", to: "index.d.ts" },
{ from: "../generated/sharedworker.iterable.generated.d.ts", to: "index.iterable.d.ts", autoImport: true },
{ from: "../generated/sharedworker.iterable.generated.d.ts", to: "iterable.d.ts", autoImport: true },
],
},
];
Expand Down
1 change: 1 addition & 0 deletions deploy/readmes/audioworklet.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ To use `@types/audioworklet` you need to do two things:

That's all.

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+.

## SemVer

Expand Down
1 change: 1 addition & 0 deletions deploy/readmes/serviceworker.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ To use `@types/serviceworker` you need to do two things:

That's all.

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+.

## SemVer

Expand Down
3 changes: 2 additions & 1 deletion deploy/readmes/sharedworker.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ This package contains type definitions which will set up the global environment
To use `@types/sharedworker` you need to do two things:

1. Install the dependency: `npm install @types/sharedworker --save-dev`, `yarn add @types/sharedworker --dev` or `pnpm add @types/sharedworker --dev`.

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.

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"]`
1. **With "lib"** - You should remove `"dom"`.

That's all.

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+.

## SemVer

Expand Down
19 changes: 18 additions & 1 deletion deploy/readmes/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ The APIs inside `@types/web` are [generated from](https://github.com/microsoft/T

## Installation

With TypeScript 4.5+ using [lib replacement](https://github.com/microsoft/TypeScript/pull/45771), you can swap the DOM lib with this dependency:

```sh
pnpm add @typescript/lib-dom@npm:@types/web --save-dev
npm install @typescript/lib-dom@npm:@types/web --save-dev
yarn add @typescript/lib-dom@npm:@types/web --dev
```

That's all.

<details>
<summary>TypeScript 4.4 and below</summary>

<br/>
To use `@types/web` you need to do two things:

1. Install the dependency: `npm install @types/web --save-dev`, `yarn add @types/web --dev` or `pnpm add @types/web --dev`.
Expand All @@ -17,7 +31,10 @@ To use `@types/web` you need to do two things:
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"]`
1. **With "lib"** - You should remove `"dom"`.

That's all.
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.

</details>


## SemVer

Expand Down
26 changes: 22 additions & 4 deletions deploy/readmes/webworker.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,34 @@ This package contains type definitions which will set up the global environment

## Installation

With TypeScript 4.5+ using [lib replacement](https://github.com/microsoft/TypeScript/pull/45771), you can swap the WebWorker lib with this dependency:

```sh
pnpm add @typescript/lib-webworker@npm:@types/webworker --save-dev
npm install @typescript/lib-webworker@npm:@types/webworker --save-dev
yarn add @typescript/lib-webworker@npm:@types/webworker --dev
```

That's all.

<details>
<summary>TypeScript 4.4 and below</summary>

<br/>
To use `@types/webworker` you need to do two things:

1. Install the dependency: `npm install @types/webworker --save-dev`, `yarn add @types/webworker --dev` or `pnpm add @types/webworker --dev`.
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.
1. Install the dependency: `npm install @types/webworker --save-dev`, `yarn add @types/webworker --dev` or `pnpm add @types/webworker --save-dev`.

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.

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"]`
1. **With "lib"** - You should remove `"dom"`.
1. **With "lib"** - You should remove `"webworker"`.

That's all.
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.

</details>

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+.

## SemVer

Expand Down