Put current version of window-or-global in the root (#47208)

* Put current version of window-or-global in the root

Previously, the code that supports the oldest version of Typescript was in the root: 3.1 and below. Newer versions were in ts*/ subdirectories.

This PR puts the newest version in the root, and older versions -- before 3.4 in this case -- in ts*/ subdirectories. This is possible because all supported versions of the Typescript now understand the typesVersions property in package.json.

This PR needs a new version of DefinitelyTyped-tools and dtslint, which I will ship soon. It also needs to be brought up to date with master.

* delete ts3.4
This commit is contained in:
Nathan Shively-Sanders 2020-09-01 13:00:08 -07:00 committed by GitHub
parent b0f14dcb37
commit b10b9a1da0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 21 deletions

View File

@ -7,5 +7,5 @@
/// <reference types="node" />
declare const _: typeof self | typeof global;
declare const _: typeof globalThis & (typeof self | typeof global);
export = _;

View File

@ -2,9 +2,9 @@
"private": true,
"types": "index",
"typesVersions": {
">=3.4.0-0": {
"<=3.3": {
"*": [
"ts3.4/*"
"ts3.3/*"
]
}
}

View File

@ -0,0 +1,4 @@
/// <reference types="node" />
declare const _: typeof self | typeof global;
export = _;

View File

@ -0,0 +1,8 @@
import * as root from "window-or-global";
if ('location' in root) {
const location: Location = root.location;
root.addEventListener("click", () => console.log("Hi!"));
} else {
const process: NodeJS.Process = root.process;
}

View File

@ -1,4 +0,0 @@
/// <reference types="node" />
declare const _: typeof globalThis & (typeof self | typeof global);
export = _;

View File

@ -1,9 +0,0 @@
import * as root from "window-or-global";
if (Reflect.has(root, "location")) {
// $ExpectType Location
root.location;
} else if (Reflect.has(root, "process")) {
// $ExpectType Process
root.process;
}

View File

@ -1,8 +1,9 @@
import * as root from "window-or-global";
if ('location' in root) {
const location: Location = root.location;
root.addEventListener("click", () => console.log("Hi!"));
} else {
const process: NodeJS.Process = root.process;
if (Reflect.has(root, "location")) {
// $ExpectType Location
root.location;
} else if (Reflect.has(root, "process")) {
// $ExpectType Process
root.process;
}