mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
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:
parent
b0f14dcb37
commit
b10b9a1da0
2
types/window-or-global/index.d.ts
vendored
2
types/window-or-global/index.d.ts
vendored
@ -7,5 +7,5 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare const _: typeof self | typeof global;
|
||||
declare const _: typeof globalThis & (typeof self | typeof global);
|
||||
export = _;
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
"private": true,
|
||||
"types": "index",
|
||||
"typesVersions": {
|
||||
">=3.4.0-0": {
|
||||
"<=3.3": {
|
||||
"*": [
|
||||
"ts3.4/*"
|
||||
"ts3.3/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
4
types/window-or-global/ts3.3/index.d.ts
vendored
Normal file
4
types/window-or-global/ts3.3/index.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
declare const _: typeof self | typeof global;
|
||||
export = _;
|
||||
8
types/window-or-global/ts3.3/window-or-global-tests.ts
Normal file
8
types/window-or-global/ts3.3/window-or-global-tests.ts
Normal 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;
|
||||
}
|
||||
4
types/window-or-global/ts3.4/index.d.ts
vendored
4
types/window-or-global/ts3.4/index.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
declare const _: typeof globalThis & (typeof self | typeof global);
|
||||
export = _;
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user