From b4c9ac9786544e539ecc2f54ff1e9c9b31302c9b Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Wed, 13 Apr 2022 00:55:48 +0900 Subject: [PATCH 01/10] feat: update to TypeScript 4.7-beta --- package.json | 4 ++-- packages/typescript-estree/src/parser.ts | 4 ++-- yarn.lock | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index d889f08dffa3..afd60e5d9754 100644 --- a/package.json +++ b/package.json @@ -105,10 +105,10 @@ "tmp": "^0.2.1", "ts-node": "^10.4.0", "tslint": "^6.1.3", - "typescript": ">=3.3.1 <4.7.0" + "typescript": ">=3.3.1 <4.6.0 || 4.7.0-beta" }, "resolutions": { "@types/node": "^16.11.4", - "typescript": "4.6.2" + "typescript": "4.7.0-beta" } } diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index f0e6ce46d3c2..45ad09945f62 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -30,12 +30,12 @@ const log = debug('typescript-eslint:typescript-estree:parser'); * This needs to be kept in sync with the top-level README.md in the * typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <4.7.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <4.8.0'; /* * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one * List them all separately here, so we can automatically create the full string */ -const SUPPORTED_PRERELEASE_RANGES: string[] = []; +const SUPPORTED_PRERELEASE_RANGES: string[] = ['4.7.0-beta']; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, diff --git a/yarn.lock b/yarn.lock index 72b54c16bf2d..3c5aff110b31 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14367,10 +14367,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, typescript@4.6.2, "typescript@>=3.3.1 <4.7.0", typescript@^4.4.3, typescript@^4.5.3, typescript@^4.5.5, typescript@~4.5.2: - version "4.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.2.tgz#fe12d2727b708f4eef40f51598b3398baa9611d4" - integrity sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg== +typescript@*, typescript@4.7.0-beta, "typescript@>=3.3.1 <4.6.0 || 4.7.0-beta", typescript@^4.4.3, typescript@^4.5.3, typescript@^4.5.5, typescript@~4.5.2: + version "4.7.0-beta" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.0-beta.tgz#15952f24d4177479ca3d19f09436ad8c69a30563" + integrity sha512-m+CNL8lzHyHDxYYDTI+pm5hw5/bufYVGan2bokPyJY/y9C/4W/PCWMtYZ0vV9fLXbEL57elMeoaz9Evxs8UQ+A== ua-parser-js@^0.7.30: version "0.7.31" From 97d5c79e3c564716fad4ecdf189f40802fddfdcc Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 16 Apr 2022 13:15:14 +0900 Subject: [PATCH 02/10] chore(ast-spec): remove `api-extractor` temporary --- packages/ast-spec/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index 2deb02c8bc85..67eca2acc4cf 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -29,7 +29,7 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "build": "tsc -b tsconfig.build.json && api-extractor run --local", + "build": "tsc -b tsconfig.build.json", "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf .rollup.cache && rimraf coverage", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", From 7b1c198d27718b52b738f3004316c6584b8ce6cf Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 16 Apr 2022 13:22:47 +0900 Subject: [PATCH 03/10] feat(types): run `generate:lib` --- .../scope-manager/src/lib/dom.iterable.ts | 4 ++ packages/scope-manager/src/lib/dom.ts | 48 +++++++++++++++++-- .../scope-manager/src/lib/es2020.bigint.ts | 2 + packages/scope-manager/src/lib/es2020.date.ts | 13 +++++ .../scope-manager/src/lib/es2020.number.ts | 13 +++++ packages/scope-manager/src/lib/es2020.ts | 4 ++ .../scope-manager/src/lib/es2022.object.ts | 2 +- .../scope-manager/src/lib/esnext.bigint.ts | 2 + packages/scope-manager/src/lib/index.ts | 4 ++ packages/scope-manager/src/lib/webworker.ts | 14 +++++- packages/types/src/lib.ts | 2 + 11 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 packages/scope-manager/src/lib/es2020.date.ts create mode 100644 packages/scope-manager/src/lib/es2020.number.ts diff --git a/packages/scope-manager/src/lib/dom.iterable.ts b/packages/scope-manager/src/lib/dom.iterable.ts index c0bddff75dd1..094303434e37 100644 --- a/packages/scope-manager/src/lib/dom.iterable.ts +++ b/packages/scope-manager/src/lib/dom.iterable.ts @@ -18,6 +18,7 @@ export const dom_iterable = { DOMStringList: TYPE, DOMTokenList: TYPE, DataTransferItemList: TYPE, + EventCounts: TYPE, FileList: TYPE, FontFaceSet: TYPE, FormData: TYPE, @@ -29,6 +30,9 @@ export const dom_iterable = { Headers: TYPE, IDBDatabase: TYPE, IDBObjectStore: TYPE, + MIDIInputMap: TYPE, + MIDIOutput: TYPE, + MIDIOutputMap: TYPE, MediaKeyStatusMap: TYPE, MediaList: TYPE, MessageEvent: TYPE, diff --git a/packages/scope-manager/src/lib/dom.ts b/packages/scope-manager/src/lib/dom.ts index 8f4910d08f16..e862fbc92d45 100644 --- a/packages/scope-manager/src/lib/dom.ts +++ b/packages/scope-manager/src/lib/dom.ts @@ -127,6 +127,9 @@ export const dom = { LockInfo: TYPE, LockManagerSnapshot: TYPE, LockOptions: TYPE, + MIDIConnectionEventInit: TYPE, + MIDIMessageEventInit: TYPE, + MIDIOptions: TYPE, MediaCapabilitiesDecodingInfo: TYPE, MediaCapabilitiesEncodingInfo: TYPE, MediaCapabilitiesInfo: TYPE, @@ -157,6 +160,7 @@ export const dom = { MouseEventInit: TYPE, MultiCacheQueryOptions: TYPE, MutationObserverInit: TYPE, + NavigationPreloadState: TYPE, NotificationAction: TYPE, NotificationOptions: TYPE, OfflineAudioCompletionEventInit: TYPE, @@ -206,6 +210,10 @@ export const dom = { RTCDataChannelEventInit: TYPE, RTCDataChannelInit: TYPE, RTCDtlsFingerprint: TYPE, + RTCEncodedAudioFrameMetadata: TYPE, + RTCEncodedVideoFrameMetadata: TYPE, + RTCErrorEventInit: TYPE, + RTCErrorInit: TYPE, RTCIceCandidateInit: TYPE, RTCIceCandidatePairStats: TYPE, RTCIceServer: TYPE, @@ -280,7 +288,9 @@ export const dom = { ULongRange: TYPE, UnderlyingSink: TYPE, UnderlyingSource: TYPE, + VideoColorSpaceInit: TYPE, VideoConfiguration: TYPE, + VideoFrameMetadata: TYPE, WaveShaperOptions: TYPE, WebGLContextAttributes: TYPE, WebGLContextEventInit: TYPE, @@ -449,6 +459,7 @@ export const dom = { ElementInternals: TYPE_VALUE, ErrorEvent: TYPE_VALUE, Event: TYPE_VALUE, + EventCounts: TYPE_VALUE, EventListener: TYPE, EventListenerObject: TYPE, EventSourceEventMap: TYPE, @@ -504,7 +515,7 @@ export const dom = { HTMLDataElement: TYPE_VALUE, HTMLDataListElement: TYPE_VALUE, HTMLDetailsElement: TYPE_VALUE, - HTMLDialogElement: TYPE, + HTMLDialogElement: TYPE_VALUE, HTMLDirectoryElement: TYPE_VALUE, HTMLDivElement: TYPE_VALUE, HTMLDocument: TYPE_VALUE, @@ -609,6 +620,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, @@ -653,6 +675,7 @@ export const dom = { MutationObserver: TYPE_VALUE, MutationRecord: TYPE_VALUE, NamedNodeMap: TYPE_VALUE, + NavigationPreloadManager: TYPE_VALUE, Navigator: TYPE_VALUE, NavigatorAutomationInformation: TYPE, NavigatorConcurrentHardware: TYPE, @@ -660,6 +683,7 @@ export const dom = { NavigatorCookies: TYPE, NavigatorID: TYPE, NavigatorLanguage: TYPE, + NavigatorLocks: TYPE, NavigatorNetworkInformation: TYPE, NavigatorOnLine: TYPE, NavigatorPlugins: TYPE, @@ -736,7 +760,12 @@ export const dom = { RTCDataChannelEvent: TYPE_VALUE, RTCDtlsTransportEventMap: TYPE, RTCDtlsTransport: TYPE_VALUE, + RTCEncodedAudioFrame: TYPE_VALUE, + RTCEncodedVideoFrame: TYPE_VALUE, + RTCError: TYPE_VALUE, + RTCErrorEvent: TYPE_VALUE, RTCIceCandidate: TYPE_VALUE, + RTCIceTransportEventMap: TYPE, RTCIceTransport: TYPE_VALUE, RTCPeerConnectionEventMap: TYPE, RTCPeerConnection: TYPE_VALUE, @@ -745,6 +774,8 @@ export const dom = { RTCRtpReceiver: TYPE_VALUE, RTCRtpSender: TYPE_VALUE, RTCRtpTransceiver: TYPE_VALUE, + RTCSctpTransportEventMap: TYPE, + RTCSctpTransport: TYPE_VALUE, RTCSessionDescription: TYPE_VALUE, RTCStatsReport: TYPE_VALUE, RTCTrackEvent: TYPE_VALUE, @@ -934,6 +965,7 @@ export const dom = { VTTCue: TYPE_VALUE, VTTRegion: TYPE_VALUE, ValidityState: TYPE_VALUE, + VideoColorSpace: TYPE_VALUE, VideoPlaybackQuality: TYPE_VALUE, VisualViewportEventMap: TYPE, VisualViewport: TYPE_VALUE, @@ -941,7 +973,6 @@ export const dom = { WEBGL_compressed_texture_astc: TYPE, WEBGL_compressed_texture_etc: TYPE, WEBGL_compressed_texture_etc1: TYPE, - WEBGL_compressed_texture_pvrtc: TYPE, WEBGL_compressed_texture_s3tc: TYPE, WEBGL_compressed_texture_s3tc_srgb: TYPE, WEBGL_debug_renderer_info: TYPE, @@ -1040,6 +1071,7 @@ export const dom = { UnderlyingSourceCancelCallback: TYPE, UnderlyingSourcePullCallback: TYPE, UnderlyingSourceStartCallback: TYPE, + VideoFrameRequestCallback: TYPE, VoidFunction: TYPE, HTMLElementTagNameMap: TYPE, HTMLElementDeprecatedTagNameMap: TYPE, @@ -1055,7 +1087,6 @@ export const dom = { CSSNumberish: TYPE, CanvasImageSource: TYPE, ClipboardItemData: TYPE, - ClipboardItemDataType: TYPE, ClipboardItems: TYPE, ConstrainBoolean: TYPE, ConstrainDOMString: TYPE, @@ -1170,6 +1201,9 @@ export const dom = { KeyUsage: TYPE, LineAlignSetting: TYPE, LockMode: TYPE, + MIDIPortConnectionState: TYPE, + MIDIPortDeviceState: TYPE, + MIDIPortType: TYPE, MediaDecodingType: TYPE, MediaDeviceKind: TYPE, MediaEncodingType: TYPE, @@ -1181,7 +1215,7 @@ export const dom = { MediaSessionAction: TYPE, MediaSessionPlaybackState: TYPE, MediaStreamTrackState: TYPE, - NavigationType: TYPE, + NavigationTimingType: TYPE, NotificationDirection: TYPE, NotificationPermission: TYPE, OrientationLockType: TYPE, @@ -1203,6 +1237,8 @@ export const dom = { RTCDataChannelState: TYPE, RTCDegradationPreference: TYPE, RTCDtlsTransportState: TYPE, + RTCEncodedVideoFrameType: TYPE, + RTCErrorDetailType: TYPE, RTCIceCandidateType: TYPE, RTCIceComponent: TYPE, RTCIceConnectionState: TYPE, @@ -1217,6 +1253,7 @@ export const dom = { RTCPriorityType: TYPE, RTCRtcpMuxPolicy: TYPE, RTCRtpTransceiverDirection: TYPE, + RTCSctpTransportState: TYPE, RTCSdpType: TYPE, RTCSignalingState: TYPE, RTCStatsIceCandidatePairState: TYPE, @@ -1250,7 +1287,10 @@ export const dom = { TouchType: TYPE, TransferFunction: TYPE, UserVerificationRequirement: TYPE, + VideoColorPrimaries: TYPE, VideoFacingModeEnum: TYPE, + VideoMatrixCoefficients: TYPE, + VideoTransferCharacteristics: TYPE, WebGLPowerPreference: TYPE, WorkerType: TYPE, XMLHttpRequestResponseType: TYPE, diff --git a/packages/scope-manager/src/lib/es2020.bigint.ts b/packages/scope-manager/src/lib/es2020.bigint.ts index b9a36a904b9c..3444dc701a21 100644 --- a/packages/scope-manager/src/lib/es2020.bigint.ts +++ b/packages/scope-manager/src/lib/es2020.bigint.ts @@ -4,9 +4,11 @@ // npx nx generate-lib @typescript-eslint/scope-manager import { ImplicitLibVariableOptions } from '../variable'; +import { es2020_intl } from './es2020.intl'; import { TYPE, TYPE_VALUE } from './base-config'; export const es2020_bigint = { + ...es2020_intl, BigIntToLocaleStringOptions: TYPE, BigInt: TYPE_VALUE, BigIntConstructor: TYPE, diff --git a/packages/scope-manager/src/lib/es2020.date.ts b/packages/scope-manager/src/lib/es2020.date.ts new file mode 100644 index 000000000000..1a5ed0d23f3e --- /dev/null +++ b/packages/scope-manager/src/lib/es2020.date.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 { ImplicitLibVariableOptions } from '../variable'; +import { es2020_intl } from './es2020.intl'; +import { TYPE } from './base-config'; + +export const es2020_date = { + ...es2020_intl, + Date: TYPE, +} as Record; diff --git a/packages/scope-manager/src/lib/es2020.number.ts b/packages/scope-manager/src/lib/es2020.number.ts new file mode 100644 index 000000000000..04ba01bc4bf3 --- /dev/null +++ b/packages/scope-manager/src/lib/es2020.number.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 { ImplicitLibVariableOptions } from '../variable'; +import { es2020_intl } from './es2020.intl'; +import { TYPE } from './base-config'; + +export const es2020_number = { + ...es2020_intl, + Number: TYPE, +} as Record; diff --git a/packages/scope-manager/src/lib/es2020.ts b/packages/scope-manager/src/lib/es2020.ts index 5870ed389819..3a89464f4563 100644 --- a/packages/scope-manager/src/lib/es2020.ts +++ b/packages/scope-manager/src/lib/es2020.ts @@ -6,6 +6,8 @@ import { ImplicitLibVariableOptions } from '../variable'; import { es2019 } from './es2019'; import { es2020_bigint } from './es2020.bigint'; +import { es2020_date } from './es2020.date'; +import { es2020_number } from './es2020.number'; import { es2020_promise } from './es2020.promise'; import { es2020_sharedmemory } from './es2020.sharedmemory'; import { es2020_string } from './es2020.string'; @@ -15,6 +17,8 @@ import { es2020_intl } from './es2020.intl'; export const es2020 = { ...es2019, ...es2020_bigint, + ...es2020_date, + ...es2020_number, ...es2020_promise, ...es2020_sharedmemory, ...es2020_string, diff --git a/packages/scope-manager/src/lib/es2022.object.ts b/packages/scope-manager/src/lib/es2022.object.ts index 085508ad391a..650a01c38355 100644 --- a/packages/scope-manager/src/lib/es2022.object.ts +++ b/packages/scope-manager/src/lib/es2022.object.ts @@ -7,5 +7,5 @@ import { ImplicitLibVariableOptions } from '../variable'; import { TYPE } from './base-config'; export const es2022_object = { - Object: TYPE, + ObjectConstructor: TYPE, } as Record; diff --git a/packages/scope-manager/src/lib/esnext.bigint.ts b/packages/scope-manager/src/lib/esnext.bigint.ts index 1b8afa30f385..079bc59bf87d 100644 --- a/packages/scope-manager/src/lib/esnext.bigint.ts +++ b/packages/scope-manager/src/lib/esnext.bigint.ts @@ -4,9 +4,11 @@ // npx nx generate-lib @typescript-eslint/scope-manager import { ImplicitLibVariableOptions } from '../variable'; +import { es2020_intl } from './es2020.intl'; import { TYPE, TYPE_VALUE } from './base-config'; export const esnext_bigint = { + ...es2020_intl, BigIntToLocaleStringOptions: TYPE, BigInt: TYPE_VALUE, BigIntConstructor: TYPE, diff --git a/packages/scope-manager/src/lib/index.ts b/packages/scope-manager/src/lib/index.ts index 96a840e477c4..ab0328f7cf08 100644 --- a/packages/scope-manager/src/lib/index.ts +++ b/packages/scope-manager/src/lib/index.ts @@ -46,11 +46,13 @@ import { es2019_object } from './es2019.object'; import { es2019_string } from './es2019.string'; import { es2019_symbol } from './es2019.symbol'; import { es2020_bigint } from './es2020.bigint'; +import { es2020_date } from './es2020.date'; import { es2020_promise } from './es2020.promise'; import { es2020_sharedmemory } from './es2020.sharedmemory'; import { es2020_string } from './es2020.string'; import { es2020_symbol_wellknown } from './es2020.symbol.wellknown'; import { es2020_intl } from './es2020.intl'; +import { es2020_number } from './es2020.number'; import { es2021_promise } from './es2021.promise'; import { es2021_string } from './es2021.string'; import { es2021_weakref } from './es2021.weakref'; @@ -121,11 +123,13 @@ const lib = { 'es2019.string': es2019_string, 'es2019.symbol': es2019_symbol, 'es2020.bigint': es2020_bigint, + 'es2020.date': es2020_date, 'es2020.promise': es2020_promise, 'es2020.sharedmemory': es2020_sharedmemory, 'es2020.string': es2020_string, 'es2020.symbol.wellknown': es2020_symbol_wellknown, 'es2020.intl': es2020_intl, + 'es2020.number': es2020_number, 'es2021.promise': es2021_promise, 'es2021.string': es2021_string, 'es2021.weakref': es2021_weakref, diff --git a/packages/scope-manager/src/lib/webworker.ts b/packages/scope-manager/src/lib/webworker.ts index d6c158ff9a01..55e4f2b58c57 100644 --- a/packages/scope-manager/src/lib/webworker.ts +++ b/packages/scope-manager/src/lib/webworker.ts @@ -69,6 +69,7 @@ export const webworker = { MediaEncodingConfiguration: TYPE, MessageEventInit: TYPE, MultiCacheQueryOptions: TYPE, + NavigationPreloadState: TYPE, NotificationAction: TYPE, NotificationEventInit: TYPE, NotificationOptions: TYPE, @@ -84,6 +85,8 @@ export const webworker = { PushSubscriptionOptionsInit: TYPE, QueuingStrategy: TYPE, QueuingStrategyInit: TYPE, + RTCEncodedAudioFrameMetadata: TYPE, + RTCEncodedVideoFrameMetadata: TYPE, ReadableStreamDefaultReadDoneResult: TYPE, ReadableStreamDefaultReadValueResult: TYPE, ReadableWritablePair: TYPE, @@ -106,6 +109,7 @@ export const webworker = { Transformer: TYPE, UnderlyingSink: TYPE, UnderlyingSource: TYPE, + VideoColorSpaceInit: TYPE, VideoConfiguration: TYPE, WebGLContextAttributes: TYPE, WebGLContextEventInit: TYPE, @@ -206,9 +210,11 @@ export const webworker = { MessageEvent: TYPE_VALUE, MessagePortEventMap: TYPE, MessagePort: TYPE_VALUE, + NavigationPreloadManager: TYPE_VALUE, NavigatorConcurrentHardware: TYPE, NavigatorID: TYPE, NavigatorLanguage: TYPE, + NavigatorLocks: TYPE, NavigatorNetworkInformation: TYPE, NavigatorOnLine: TYPE, NavigatorStorage: TYPE, @@ -246,6 +252,8 @@ export const webworker = { PushMessageData: TYPE_VALUE, PushSubscription: TYPE_VALUE, PushSubscriptionOptions: TYPE_VALUE, + RTCEncodedAudioFrame: TYPE_VALUE, + RTCEncodedVideoFrame: TYPE_VALUE, ReadableStream: TYPE_VALUE, ReadableStreamDefaultController: TYPE_VALUE, ReadableStreamDefaultReader: TYPE_VALUE, @@ -276,11 +284,11 @@ export const webworker = { TransformStreamDefaultController: TYPE_VALUE, URL: TYPE_VALUE, URLSearchParams: TYPE_VALUE, + VideoColorSpace: TYPE_VALUE, WEBGL_color_buffer_float: TYPE, WEBGL_compressed_texture_astc: TYPE, WEBGL_compressed_texture_etc: TYPE, WEBGL_compressed_texture_etc1: TYPE, - WEBGL_compressed_texture_pvrtc: TYPE, WEBGL_compressed_texture_s3tc: TYPE, WEBGL_compressed_texture_s3tc_srgb: TYPE, WEBGL_debug_renderer_info: TYPE, @@ -421,6 +429,7 @@ export const webworker = { PredefinedColorSpace: TYPE, PremultiplyAlpha: TYPE, PushEncryptionKeyName: TYPE, + RTCEncodedVideoFrameType: TYPE, ReferrerPolicy: TYPE, RequestCache: TYPE, RequestCredentials: TYPE, @@ -433,6 +442,9 @@ export const webworker = { ServiceWorkerState: TYPE, ServiceWorkerUpdateViaCache: TYPE, TransferFunction: TYPE, + VideoColorPrimaries: TYPE, + VideoMatrixCoefficients: TYPE, + VideoTransferCharacteristics: TYPE, WebGLPowerPreference: TYPE, WorkerType: TYPE, XMLHttpRequestResponseType: TYPE, diff --git a/packages/types/src/lib.ts b/packages/types/src/lib.ts index 3e362ad33cb9..9310996e5168 100644 --- a/packages/types/src/lib.ts +++ b/packages/types/src/lib.ts @@ -47,11 +47,13 @@ type Lib = | 'es2019.string' | 'es2019.symbol' | 'es2020.bigint' + | 'es2020.date' | 'es2020.promise' | 'es2020.sharedmemory' | 'es2020.string' | 'es2020.symbol.wellknown' | 'es2020.intl' + | 'es2020.number' | 'es2021.promise' | 'es2021.string' | 'es2021.weakref' From 547d1725c98edf0b095fae38f92f55c277a71d75 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 17 Apr 2022 00:25:11 +0900 Subject: [PATCH 04/10] chore(typescript-estree): add `ts.TypeQueryNode` to `EstreeToTsNodeTypes[TSTypeParameterInstantiation]` --- .../typescript-estree/src/ts-estree/estree-to-ts-node-types.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts index 9c71608424bc..0398d1991c20 100644 --- a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts +++ b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts @@ -217,7 +217,8 @@ export interface EstreeToTsNodeTypes { | ts.JsxOpeningElement | ts.JsxSelfClosingElement | ts.NewExpression - | ts.CallExpression; + | ts.CallExpression + | ts.TypeQueryNode; [AST_NODE_TYPES.TSTypePredicate]: ts.TypePredicateNode; [AST_NODE_TYPES.TSTypeQuery]: ts.TypeQueryNode; [AST_NODE_TYPES.TSTypeReference]: ts.TypeReferenceNode; From cb305c0dfccad3c988ffd456e8e3c6f59bd08d35 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 17 Apr 2022 13:30:00 +0900 Subject: [PATCH 05/10] fix(utils): fix type errors --- packages/utils/src/ast-utils/helpers.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/utils/src/ast-utils/helpers.ts b/packages/utils/src/ast-utils/helpers.ts index baf4daf68101..fa2b8bb9f5cb 100644 --- a/packages/utils/src/ast-utils/helpers.ts +++ b/packages/utils/src/ast-utils/helpers.ts @@ -26,9 +26,7 @@ export const isNodeOfTypeWithConditions = < ): (( node: TSESTree.Node | null | undefined, ) => node is TSESTree.Node & { type: NodeType } & Conditions) => { - const entries = Object.entries(conditions) as ObjectEntries< - TSESTree.Node & { type: NodeType } - >; + const entries = Object.entries(conditions) as ObjectEntries; return ( node: TSESTree.Node | null | undefined, @@ -46,9 +44,7 @@ export const isTokenOfTypeWithConditions = < ): (( token: TSESTree.Token | null | undefined, ) => token is TSESTree.Token & { type: TokenType } & Conditions) => { - const entries = Object.entries(conditions) as ObjectEntries< - TSESTree.Token & { type: TokenType } - >; + const entries = Object.entries(conditions) as ObjectEntries; return ( token: TSESTree.Token | null | undefined, From eb2bcc5584d09be9a2df9b2793a1c56dcd07ee11 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 17 Apr 2022 14:29:39 +0900 Subject: [PATCH 06/10] fix(eslint-plugin): avoid syntax errors --- packages/eslint-plugin/src/rules/ban-types.ts | 3 ++- .../src/rules/consistent-indexed-object-style.ts | 2 +- packages/eslint-plugin/src/util/getESLintCoreRule.ts | 12 +++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index 38224b15ce93..3eb48fb72558 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -185,7 +185,8 @@ export default util.createRule({ customMessage, }, fix: fixWith - ? (fixer): TSESLint.RuleFix => fixer.replaceText(typeNode, fixWith) + ? (fixer: TSESLint.RuleFixer): TSESLint.RuleFix => + fixer.replaceText(typeNode, fixWith) : null, }); } diff --git a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts index bd511d0cd0ef..5f2a930db494 100644 --- a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts +++ b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts @@ -84,7 +84,7 @@ export default createRule({ node, messageId: 'preferRecord', fix: safeFix - ? (fixer): TSESLint.RuleFix => { + ? (fixer: TSESLint.RuleFixer): TSESLint.RuleFix => { const key = sourceCode.getText(keyType.typeAnnotation); const value = sourceCode.getText(valueType.typeAnnotation); const record = member.readonly diff --git a/packages/eslint-plugin/src/util/getESLintCoreRule.ts b/packages/eslint-plugin/src/util/getESLintCoreRule.ts index 5ba9ae369659..a26a06765015 100644 --- a/packages/eslint-plugin/src/util/getESLintCoreRule.ts +++ b/packages/eslint-plugin/src/util/getESLintCoreRule.ts @@ -42,16 +42,18 @@ type RuleId = keyof RuleMap; export const getESLintCoreRule: (ruleId: R) => RuleMap[R] = isESLintV8 - ? (ruleId: R): RuleMap[R] => - ESLintUtils.nullThrows( + ? function (ruleId: R): RuleMap[R] { + return ESLintUtils.nullThrows( // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call require('eslint/use-at-your-own-risk').builtinRules.get( ruleId, ) as RuleMap[R], `ESLint's core rule '${ruleId}' not found.`, - ) - : (ruleId: R): RuleMap[R] => - require(`eslint/lib/rules/${ruleId}`) as RuleMap[R]; + ); + } + : function (ruleId: R): RuleMap[R] { + return require(`eslint/lib/rules/${ruleId}`) as RuleMap[R]; + }; export function maybeGetESLintCoreRule( ruleId: R, From c390c671f47f8b053c9b422cf20bdae60d585bdc Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 17 Apr 2022 14:30:00 +0900 Subject: [PATCH 07/10] fix(eslint-plugin): avoid type errors --- .../eslint-plugin/src/rules/no-unnecessary-type-arguments.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts index 294adf554adb..e248181a6a5d 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -12,7 +12,8 @@ type ParameterCapableTSNode = | ts.TypeReferenceNode | ts.ExpressionWithTypeArguments | ts.JsxOpeningElement - | ts.JsxSelfClosingElement; + | ts.JsxSelfClosingElement + | ts.TypeQueryNode; type MessageIds = 'unnecessaryTypeParameter'; From 04efb6cf9cd4e9422c8d0292f4778c483b31239d Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 17 Apr 2022 14:31:18 +0900 Subject: [PATCH 08/10] test(typescript-estree): update snapshots --- .../tests/lib/__snapshots__/convert.test.ts.snap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap index ef7abcee4f4a..0ea5f89cdcdb 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap @@ -49,7 +49,7 @@ Object { "line": 1, }, }, - "nodeCount": 7, + "nodeCount": 8, "parseDiagnostics": Array [], "pragmas": Map {}, "range": Array [ @@ -58,6 +58,7 @@ Object { ], "referencedFiles": Array [], "scriptKind": 4, + "setExternalModuleIndicator": [Function], "statements": Array [ Object { "expression": Object { From ee04ac64fe9f6c629cd4c427f35f33a95d9033c5 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 17 Apr 2022 19:49:58 +0900 Subject: [PATCH 09/10] feat(ast-spec): add `PrivateIdentifier` to `TSQualifiedName.right` --- packages/ast-spec/src/type/TSQualifiedName/spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/ast-spec/src/type/TSQualifiedName/spec.ts b/packages/ast-spec/src/type/TSQualifiedName/spec.ts index cdd6feeee0ef..d9c550abaa3e 100644 --- a/packages/ast-spec/src/type/TSQualifiedName/spec.ts +++ b/packages/ast-spec/src/type/TSQualifiedName/spec.ts @@ -1,10 +1,11 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { BaseNode } from '../../base/BaseNode'; import type { Identifier } from '../../expression/Identifier/spec'; +import type { PrivateIdentifier } from '../../special/PrivateIdentifier/spec'; import type { EntityName } from '../../unions/EntityName'; export interface TSQualifiedName extends BaseNode { type: AST_NODE_TYPES.TSQualifiedName; left: EntityName; - right: Identifier; + right: Identifier | PrivateIdentifier; } From af7b0f346500506ed48421e630b4390018cdf6ac Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 17 Apr 2022 20:01:07 +0900 Subject: [PATCH 10/10] test(typescript-estree): add tests for `typeof` private --- .../typescript/types/typeof-private.src.ts | 9 + .../tests/ast-alignment/fixtures-to-test.ts | 5 + .../semantic-diagnostics-enabled.test.ts.snap | 2 + .../types/typeof-private.src.ts.shot | 1428 +++++++++++++++++ 4 files changed, 1444 insertions(+) create mode 100644 packages/shared-fixtures/fixtures/typescript/types/typeof-private.src.ts create mode 100644 packages/typescript-estree/tests/snapshots/typescript/types/typeof-private.src.ts.shot diff --git a/packages/shared-fixtures/fixtures/typescript/types/typeof-private.src.ts b/packages/shared-fixtures/fixtures/typescript/types/typeof-private.src.ts new file mode 100644 index 000000000000..b3a00eff7d1e --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/typeof-private.src.ts @@ -0,0 +1,9 @@ +class Container { + #data = "hello!"; + get data(): typeof this.#data { + return this.#data; + } + set data(value: typeof this.#data) { + this.#data = value; + } +} diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 5c3900f5ba8e..1ff21421e8f4 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -482,6 +482,11 @@ tester.addFixturePatternConfig('typescript/types', { 'template-literal-type-2', 'template-literal-type-3', 'template-literal-type-4', + /** + * [BABEL ERRORED, BUT TS-ESTREE DID NOT] + * Babel doesn't support TS 4.7 new features yet. + */ + 'typeof-private', ], }); diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap index 03f030ad731e..229cd2e83de8 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap @@ -2774,6 +2774,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/typeof.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/typeof-private.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/union-intersection.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/union-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/typeof-private.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/typeof-private.src.ts.shot new file mode 100644 index 000000000000..fe8dd582068c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/typeof-private.src.ts.shot @@ -0,0 +1,1428 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types typeof-private.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "declare": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "data", + "range": Array [ + 20, + 25, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "override": false, + "range": Array [ + 20, + 37, + ], + "readonly": undefined, + "static": false, + "type": "PropertyDefinition", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 28, + 36, + ], + "raw": "\\"hello!\\"", + "type": "Literal", + "value": "hello!", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "data", + "range": Array [ + 44, + 48, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "override": false, + "range": Array [ + 40, + 98, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 83, + 87, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "data", + "range": Array [ + 88, + 93, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 83, + 93, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 76, + 94, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 32, + "line": 3, + }, + }, + "range": Array [ + 70, + 98, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 48, + 98, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 50, + 69, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "exprName": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "name": "this", + "range": Array [ + 59, + 63, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 59, + 69, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "data", + "range": Array [ + 64, + 69, + ], + "type": "PrivateIdentifier", + }, + "type": "TSQualifiedName", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 52, + 69, + ], + "type": "TSTypeQuery", + }, + }, + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "name": "data", + "range": Array [ + 105, + 109, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "override": false, + "range": Array [ + 101, + 165, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 142, + 146, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "name": "data", + "range": Array [ + 147, + 152, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 142, + 152, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "operator": "=", + "range": Array [ + 142, + 160, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "name": "value", + "range": Array [ + 155, + 160, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 142, + 161, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 37, + "line": 6, + }, + }, + "range": Array [ + 136, + 165, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "name": "value", + "range": Array [ + 110, + 134, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 115, + 134, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "exprName": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 6, + }, + }, + "name": "this", + "range": Array [ + 124, + 128, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 6, + }, + }, + "range": Array [ + 124, + 134, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 30, + "line": 6, + }, + }, + "name": "data", + "range": Array [ + 129, + 134, + ], + "type": "PrivateIdentifier", + }, + "type": "TSQualifiedName", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 117, + 134, + ], + "type": "TSTypeQuery", + }, + }, + }, + ], + "range": Array [ + 109, + 165, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 167, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Container", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 167, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 168, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + "value": "Container", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 25, + ], + "type": "Identifier", + "value": "#data", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "String", + "value": "\\"hello!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 44, + 48, + ], + "type": "Identifier", + "value": "data", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 59, + 63, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 64, + 69, + ], + "type": "Identifier", + "value": "#data", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 83, + 87, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 88, + 93, + ], + "type": "Identifier", + "value": "#data", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 101, + 104, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 105, + 109, + ], + "type": "Identifier", + "value": "data", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 110, + 115, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 117, + 123, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 6, + }, + }, + "range": Array [ + 124, + 128, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 6, + }, + "start": Object { + "column": 29, + "line": 6, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 30, + "line": 6, + }, + }, + "range": Array [ + 129, + 134, + ], + "type": "Identifier", + "value": "#data", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 6, + }, + "start": Object { + "column": 37, + "line": 6, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 142, + 146, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 147, + 152, + ], + "type": "Identifier", + "value": "#data", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 153, + 154, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 155, + 160, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 22, + "line": 7, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`;