Skip to content
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

feat: update TypeScript to 5.0 RC #6570

Merged
merged 18 commits into from Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -78,7 +78,7 @@
"cross-env": "^7.0.3",
"cross-fetch": "^3.1.5",
"cspell": "^6.0.0",
"downlevel-dts": ">=0.10.0",
"downlevel-dts": ">=0.11.0",
"eslint": "^8.15.0",
"eslint-plugin-deprecation": "^1.3.2",
"eslint-plugin-eslint-comments": "^3.2.0",
Expand Down Expand Up @@ -107,10 +107,10 @@
"ts-node": "10.7.0",
"tslint": "^6.1.3",
"tsx": "^3.12.1",
"typescript": ">=3.3.1 <5.0.0"
"typescript": ">=3.3.1 <4.9.5 || 5.0.1-rc"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to be so strict here? If we release 4.9.6 (however unlikely), that'll cause problems. That and I see basically no future in which we change the APIs post-RC, so it feels pretty safe to just bump this to < 5.1.0.

Though, I also think that you shouldn't specify versions here at all; given ts-eslint prints a very loud warning about using a potentially incompatible TypeScript version, this particular bit IMO only causes pain when trying to get package managers happy in the TypeScript repo or when testing newer releases of TypeScript in other repos...

Copy link
Member

@bradzacher bradzacher Mar 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the private package.json for our repo, and is not published to the outside world.
Each package that actually depends on TS uses an optional, unbounded peer dependency on TS:

"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},


This range here is primarily here as our "top level" range to clearly specify the range for the project. At some point we want to automatically flow this value into our docs and package as the single point-of-definition.
It actually doesn't even do anything technically because just below it we have a resolution which forces a specific version of TS (eg this PR sets it to ~5.0.1-rc).

I agree though that we should probably keep it as <5.0.0 instead of dropping it down to <4.9.5

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, oops. I'm conflating this with the fact that prereleases in the tree don't satisfy "*" or "latest" and cause duplication (boo).

},
"resolutions": {
"typescript": "~4.9.3",
"typescript": "~5.0.1-rc",
"@types/node": "^18.11.9",
"@jest/create-cache-key-function": "^29",
"@jest/reporters": "^29",
Expand Down
2 changes: 1 addition & 1 deletion packages/ast-spec/package.json
Expand Up @@ -46,7 +46,7 @@
"@babel/core": "*",
"@babel/eslint-parser": "*",
"@babel/parser": "*",
"@microsoft/api-extractor": "^7.23.2",
"@microsoft/api-extractor": "^7.34.4",
"@types/babel__core": "*",
"glob": "*",
"jest-diff": "*",
Expand Down
Expand Up @@ -83,6 +83,12 @@ function describeLiteralType(type: ts.Type): string {
}

if (type.isLiteral()) {
if (typeof type.value === 'object') {
// Print ts.PseudoBigInt
return `${
type.value.negative ? '-' : ''
}${type.value.base10Value.toString()}n`;
}
return type.value.toString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be handled instead by the condition on line 111
We should move that branch up instaed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

Expand Down
14 changes: 14 additions & 0 deletions packages/scope-manager/src/lib/decorators.legacy.ts
@@ -0,0 +1,14 @@
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib @typescript-eslint/scope-manager

import type { ImplicitLibVariableOptions } from '../variable';
import { TYPE } from './base-config';

export const decorators_legacy = {
ClassDecorator: TYPE,
PropertyDecorator: TYPE,
MethodDecorator: TYPE,
ParameterDecorator: TYPE,
} as Record<string, ImplicitLibVariableOptions>;
20 changes: 20 additions & 0 deletions packages/scope-manager/src/lib/decorators.ts
@@ -0,0 +1,20 @@
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib @typescript-eslint/scope-manager

import type { ImplicitLibVariableOptions } from '../variable';
import { TYPE } from './base-config';

export const decorators = {
ClassMemberDecoratorContext: TYPE,
DecoratorContext: TYPE,
ClassDecoratorContext: TYPE,
ClassMethodDecoratorContext: TYPE,
ClassGetterDecoratorContext: TYPE,
ClassSetterDecoratorContext: TYPE,
ClassAccessorDecoratorContext: TYPE,
ClassAccessorDecoratorTarget: TYPE,
ClassAccessorDecoratorResult: TYPE,
ClassFieldDecoratorContext: TYPE,
} as Record<string, ImplicitLibVariableOptions>;
4 changes: 4 additions & 0 deletions packages/scope-manager/src/lib/dom.iterable.ts
Expand Up @@ -10,6 +10,7 @@ export const dom_iterable = {
AudioParam: TYPE,
AudioParamMap: TYPE,
BaseAudioContext: TYPE,
CSSKeyframesRule: TYPE,
CSSRuleList: TYPE,
CSSStyleDeclaration: TYPE,
Cache: TYPE,
Expand All @@ -31,6 +32,9 @@ export const dom_iterable = {
Headers: TYPE,
IDBDatabase: TYPE,
IDBObjectStore: TYPE,
MIDIInputMap: TYPE,
MIDIOutput: TYPE,
MIDIOutputMap: TYPE,
MediaKeyStatusMap: TYPE,
MediaList: TYPE,
MessageEvent: TYPE,
Expand Down
26 changes: 23 additions & 3 deletions packages/scope-manager/src/lib/dom.ts
Expand Up @@ -38,6 +38,7 @@ export const dom = {
CanvasRenderingContext2DSettings: TYPE,
ChannelMergerOptions: TYPE,
ChannelSplitterOptions: TYPE,
CheckVisibilityOptions: TYPE,
ClientQueryOptions: TYPE,
ClipboardEventInit: TYPE,
ClipboardItemOptions: TYPE,
Expand Down Expand Up @@ -115,6 +116,7 @@ export const dom = {
ImageBitmapOptions: TYPE,
ImageBitmapRenderingContextSettings: TYPE,
ImageDataSettings: TYPE,
ImageEncodeOptions: TYPE,
ImportMeta: TYPE,
InputEventInit: TYPE,
IntersectionObserverEntryInit: TYPE,
Expand All @@ -128,6 +130,9 @@ export const dom = {
LockInfo: TYPE,
LockManagerSnapshot: TYPE,
LockOptions: TYPE,
MIDIConnectionEventInit: TYPE,
MIDIMessageEventInit: TYPE,
MIDIOptions: TYPE,
MediaCapabilitiesDecodingInfo: TYPE,
MediaCapabilitiesEncodingInfo: TYPE,
MediaCapabilitiesInfo: TYPE,
Expand Down Expand Up @@ -354,6 +359,7 @@ export const dom = {
CSSContainerRule: TYPE_VALUE,
CSSCounterStyleRule: TYPE_VALUE,
CSSFontFaceRule: TYPE_VALUE,
CSSFontFeatureValuesRule: TYPE_VALUE,
CSSFontPaletteValuesRule: TYPE_VALUE,
CSSGroupingRule: TYPE_VALUE,
CSSImportRule: TYPE_VALUE,
Expand Down Expand Up @@ -441,8 +447,6 @@ export const dom = {
DeviceOrientationEvent: TYPE_VALUE,
DocumentEventMap: TYPE,
Document: TYPE_VALUE,
DocumentAndElementEventHandlersEventMap: TYPE,
DocumentAndElementEventHandlers: TYPE,
DocumentFragment: TYPE_VALUE,
DocumentOrShadowRoot: TYPE,
DocumentTimeline: TYPE_VALUE,
Expand Down Expand Up @@ -628,6 +632,17 @@ export const dom = {
Location: TYPE_VALUE,
Lock: TYPE_VALUE,
LockManager: TYPE_VALUE,
MIDIAccessEventMap: TYPE,
MIDIAccess: TYPE_VALUE,
MIDIConnectionEvent: TYPE_VALUE,
MIDIInputEventMap: TYPE,
MIDIInput: TYPE_VALUE,
MIDIInputMap: TYPE_VALUE,
MIDIMessageEvent: TYPE_VALUE,
MIDIOutput: TYPE_VALUE,
MIDIOutputMap: TYPE_VALUE,
MIDIPortEventMap: TYPE,
MIDIPort: TYPE_VALUE,
MathMLElementEventMap: TYPE,
MathMLElement: TYPE_VALUE,
MediaCapabilities: TYPE_VALUE,
Expand Down Expand Up @@ -1078,6 +1093,7 @@ export const dom = {
HTMLElementTagNameMap: TYPE,
HTMLElementDeprecatedTagNameMap: TYPE,
SVGElementTagNameMap: TYPE,
MathMLElementTagNameMap: TYPE,
ElementTagNameMap: TYPE,
AlgorithmIdentifier: TYPE,
BigInteger: TYPE,
Expand Down Expand Up @@ -1117,7 +1133,6 @@ export const dom = {
HeadersInit: TYPE,
IDBValidKey: TYPE,
ImageBitmapSource: TYPE,
InsertPosition: TYPE,
Int32List: TYPE,
LineAndPositionSetting: TYPE,
MediaProvider: TYPE,
Expand Down Expand Up @@ -1182,6 +1197,7 @@ export const dom = {
EndingType: TYPE,
FileSystemHandleKind: TYPE,
FillMode: TYPE,
FontDisplay: TYPE,
FontFaceLoadStatus: TYPE,
FontFaceSetLoadStatus: TYPE,
FullscreenNavigationUI: TYPE,
Expand All @@ -1195,12 +1211,16 @@ export const dom = {
IDBTransactionMode: TYPE,
ImageOrientation: TYPE,
ImageSmoothingQuality: TYPE,
InsertPosition: TYPE,
IterationCompositeOperation: TYPE,
KeyFormat: TYPE,
KeyType: TYPE,
KeyUsage: TYPE,
LineAlignSetting: TYPE,
LockMode: TYPE,
MIDIPortConnectionState: TYPE,
MIDIPortDeviceState: TYPE,
MIDIPortType: TYPE,
MediaDecodingType: TYPE,
MediaDeviceKind: TYPE,
MediaEncodingType: TYPE,
Expand Down
1 change: 1 addition & 0 deletions packages/scope-manager/src/lib/es2015.symbol.wellknown.ts
Expand Up @@ -12,6 +12,7 @@ export const es2015_symbol_wellknown = {
SymbolConstructor: TYPE,
Symbol: TYPE,
Array: TYPE,
ReadonlyArray: TYPE,
Date: TYPE,
Map: TYPE,
WeakMap: TYPE,
Expand Down
14 changes: 14 additions & 0 deletions packages/scope-manager/src/lib/es2022.regexp.ts
@@ -0,0 +1,14 @@
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib @typescript-eslint/scope-manager

import type { ImplicitLibVariableOptions } from '../variable';
import { TYPE } from './base-config';

export const es2022_regexp = {
RegExpMatchArray: TYPE,
RegExpExecArray: TYPE,
RegExpIndicesArray: TYPE,
RegExp: TYPE,
} as Record<string, ImplicitLibVariableOptions>;
2 changes: 2 additions & 0 deletions packages/scope-manager/src/lib/es2022.ts
Expand Up @@ -9,6 +9,7 @@ import { es2022_array } from './es2022.array';
import { es2022_error } from './es2022.error';
import { es2022_intl } from './es2022.intl';
import { es2022_object } from './es2022.object';
import { es2022_regexp } from './es2022.regexp';
import { es2022_sharedmemory } from './es2022.sharedmemory';
import { es2022_string } from './es2022.string';

Expand All @@ -20,4 +21,5 @@ export const es2022 = {
...es2022_object,
...es2022_sharedmemory,
...es2022_string,
...es2022_regexp,
} as Record<string, ImplicitLibVariableOptions>;
23 changes: 23 additions & 0 deletions packages/scope-manager/src/lib/es2023.array.ts
@@ -0,0 +1,23 @@
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib @typescript-eslint/scope-manager

import type { ImplicitLibVariableOptions } from '../variable';
import { TYPE } from './base-config';

export const es2023_array = {
Array: TYPE,
ReadonlyArray: TYPE,
Int8Array: TYPE,
Uint8Array: TYPE,
Uint8ClampedArray: TYPE,
Int16Array: TYPE,
Uint16Array: TYPE,
Int32Array: TYPE,
Uint32Array: TYPE,
Float32Array: TYPE,
Float64Array: TYPE,
BigInt64Array: TYPE,
BigUint64Array: TYPE,
} as Record<string, ImplicitLibVariableOptions>;
19 changes: 19 additions & 0 deletions packages/scope-manager/src/lib/es2023.full.ts
@@ -0,0 +1,19 @@
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib @typescript-eslint/scope-manager

import type { ImplicitLibVariableOptions } from '../variable';
import { dom } from './dom';
import { dom_iterable } from './dom.iterable';
import { es2023 } from './es2023';
import { scripthost } from './scripthost';
import { webworker_importscripts } from './webworker.importscripts';

export const es2023_full = {
...es2023,
...dom,
...webworker_importscripts,
...scripthost,
...dom_iterable,
} as Record<string, ImplicitLibVariableOptions>;
13 changes: 13 additions & 0 deletions packages/scope-manager/src/lib/es2023.ts
@@ -0,0 +1,13 @@
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib @typescript-eslint/scope-manager

import type { ImplicitLibVariableOptions } from '../variable';
import { es2022 } from './es2022';
import { es2023_array } from './es2023.array';

export const es2023 = {
...es2022,
...es2023_array,
} as Record<string, ImplicitLibVariableOptions>;
8 changes: 4 additions & 4 deletions packages/scope-manager/src/lib/es5.ts
Expand Up @@ -5,8 +5,12 @@

import type { ImplicitLibVariableOptions } from '../variable';
import { TYPE, TYPE_VALUE } from './base-config';
import { decorators } from './decorators';
import { decorators_legacy } from './decorators.legacy';

export const es5 = {
...decorators,
...decorators_legacy,
Symbol: TYPE,
PropertyKey: TYPE,
PropertyDescriptor: TYPE,
Expand Down Expand Up @@ -57,10 +61,6 @@ export const es5 = {
Array: TYPE_VALUE,
ArrayConstructor: TYPE,
TypedPropertyDescriptor: TYPE,
ClassDecorator: TYPE,
PropertyDecorator: TYPE,
MethodDecorator: TYPE,
ParameterDecorator: TYPE,
PromiseConstructorLike: TYPE,
PromiseLike: TYPE,
Promise: TYPE,
Expand Down
4 changes: 2 additions & 2 deletions packages/scope-manager/src/lib/esnext.ts
Expand Up @@ -4,10 +4,10 @@
// npx nx generate-lib @typescript-eslint/scope-manager

import type { ImplicitLibVariableOptions } from '../variable';
import { es2022 } from './es2022';
import { es2023 } from './es2023';
import { esnext_intl } from './esnext.intl';

export const esnext = {
...es2022,
...es2023,
...esnext_intl,
} as Record<string, ImplicitLibVariableOptions>;
12 changes: 12 additions & 0 deletions packages/scope-manager/src/lib/index.ts
Expand Up @@ -3,6 +3,8 @@
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib @typescript-eslint/scope-manager

import { decorators } from './decorators';
import { decorators_legacy } from './decorators.legacy';
import { dom } from './dom';
import { dom_iterable } from './dom.iterable';
import { es5 } from './es5';
Expand Down Expand Up @@ -64,8 +66,12 @@ import { es2022_error } from './es2022.error';
import { es2022_full } from './es2022.full';
import { es2022_intl } from './es2022.intl';
import { es2022_object } from './es2022.object';
import { es2022_regexp } from './es2022.regexp';
import { es2022_sharedmemory } from './es2022.sharedmemory';
import { es2022_string } from './es2022.string';
import { es2023 } from './es2023';
import { es2023_array } from './es2023.array';
import { es2023_full } from './es2023.full';
import { esnext } from './esnext';
import { esnext_array } from './esnext.array';
import { esnext_asynciterable } from './esnext.asynciterable';
Expand Down Expand Up @@ -94,6 +100,7 @@ const lib = {
es2020,
es2021,
es2022,
es2023,
esnext,
dom,
'dom.iterable': dom_iterable,
Expand Down Expand Up @@ -144,6 +151,8 @@ const lib = {
'es2022.object': es2022_object,
'es2022.sharedmemory': es2022_sharedmemory,
'es2022.string': es2022_string,
'es2022.regexp': es2022_regexp,
'es2023.array': es2023_array,
'esnext.array': esnext_array,
'esnext.symbol': esnext_symbol,
'esnext.asynciterable': esnext_asynciterable,
Expand All @@ -152,13 +161,16 @@ const lib = {
'esnext.string': esnext_string,
'esnext.promise': esnext_promise,
'esnext.weakref': esnext_weakref,
decorators,
'decorators.legacy': decorators_legacy,
'es2016.full': es2016_full,
'es2017.full': es2017_full,
'es2018.full': es2018_full,
'es2019.full': es2019_full,
'es2020.full': es2020_full,
'es2021.full': es2021_full,
'es2022.full': es2022_full,
'es2023.full': es2023_full,
'esnext.full': esnext_full,
lib: libBase,
} as const;
Expand Down