johnsoncodehk / vue-tsc

vue-tsc --noEmit && vite build
https://www.npmjs.com/package/vue-tsc
MIT License
241 stars 6 forks source link

`vue-tsc --noEmit` fails right after adding "webworker" to tsconfig.json as a lib #49

Closed Ky6uk closed 3 years ago

Ky6uk commented 3 years ago

I've tried to add PWA support to Vue 3 app with vite-plugin-pwa. It looks like the plugin requires "webworker" library that should be added to the lib section into tsconfig.json. But right after doing this the command vue-tsc --noEmit starts failing.

The project had been generated with npm init vite.

Error details ```ts node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:25:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: EventListenerOrEventListenerObject, ImportExportKind, TableKind, ValueType, ExportValue, Exports, ImportValue, ModuleImports, Imports, name, HeadersInit, BodyInit, RequestInfo, BlobPart, DOMHighResTimeStamp, CanvasImageSource, OffscreenRenderingContext, MessageEventSource, ImageBitmapSource, OnErrorEventHandler, TimerHandler, PerformanceEntryList, ReadableStreamReader, ReadableStreamController, VibratePattern, AlgorithmIdentifier, HashAlgorithmIdentifier, BigInteger, NamedCurve, GLenum, GLboolean, GLbitfield, GLint, GLsizei, GLintptr, GLsizeiptr, GLuint, GLfloat, GLclampf, TexImageSource, Float32List, Int32List, GLint64, GLuint64, Uint32List, BufferSource, DOMTimeStamp, FormDataEntryValue, IDBValidKey, Transferable, ReadableStreamDefaultReadResult, BinaryType, CanvasDirection, CanvasFillRule, CanvasLineCap, CanvasLineJoin, CanvasTextAlign, CanvasTextBaseline, ClientTypes, ColorSpaceConversion, EndingType, IDBCursorDirection, IDBRequestReadyState, IDBTransactionMode, ImageOrientation, ImageSmoothingQuality, KeyFormat, KeyType, KeyUsage, NotificationDirection, NotificationPermission, OffscreenRenderingContextId, PermissionName, PermissionState, PremultiplyAlpha, PushEncryptionKeyName, PushPermissionState, ReferrerPolicy, RequestCache, RequestCredentials, RequestDestination, RequestMode, RequestRedirect, ResizeQuality, ResponseType, ServiceWorkerState, ServiceWorkerUpdateViaCache, VisibilityState, WebGLPowerPreference, WorkerType, XMLHttpRequestResponseType 25 interface Account { ~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:25:1 25 interface AddEventListenerOptions extends EventListenerOptions { ~~~~~~~~~ Conflicts are in this file. node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:3773:5 - error TS2687: All declarations of 'privateKey' must have identical modifiers. 3773 privateKey: CryptoKey; ~~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:3774:5 - error TS2687: All declarations of 'publicKey' must have identical modifiers. 3774 publicKey: CryptoKey; ~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:25:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: EventListenerOrEventListenerObject, ImportExportKind, TableKind, ValueType, ExportValue, Exports, ImportValue, ModuleImports, Imports, name, HeadersInit, BodyInit, RequestInfo, BlobPart, DOMHighResTimeStamp, CanvasImageSource, OffscreenRenderingContext, MessageEventSource, ImageBitmapSource, OnErrorEventHandler, TimerHandler, PerformanceEntryList, ReadableStreamReader, ReadableStreamController, VibratePattern, AlgorithmIdentifier, HashAlgorithmIdentifier, BigInteger, NamedCurve, GLenum, GLboolean, GLbitfield, GLint, GLsizei, GLintptr, GLsizeiptr, GLuint, GLfloat, GLclampf, TexImageSource, Float32List, Int32List, GLint64, GLuint64, Uint32List, BufferSource, DOMTimeStamp, FormDataEntryValue, IDBValidKey, Transferable, ReadableStreamDefaultReadResult, BinaryType, CanvasDirection, CanvasFillRule, CanvasLineCap, CanvasLineJoin, CanvasTextAlign, CanvasTextBaseline, ClientTypes, ColorSpaceConversion, EndingType, IDBCursorDirection, IDBRequestReadyState, IDBTransactionMode, ImageOrientation, ImageSmoothingQuality, KeyFormat, KeyType, KeyUsage, NotificationDirection, NotificationPermission, OffscreenRenderingContextId, PermissionName, PermissionState, PremultiplyAlpha, PushEncryptionKeyName, PushPermissionState, ReferrerPolicy, RequestCache, RequestCredentials, RequestDestination, RequestMode, RequestRedirect, ResizeQuality, ResponseType, ServiceWorkerState, ServiceWorkerUpdateViaCache, VisibilityState, WebGLPowerPreference, WorkerType, XMLHttpRequestResponseType 25 interface AddEventListenerOptions extends EventListenerOptions { ~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:25:1 25 interface Account { ~~~~~~~~~ Conflicts are in this file. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:89:5 - error TS2687: All declarations of 'privateKey' must have identical modifiers. 89 privateKey?: CryptoKey; ~~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:89:5 - error TS2717: Subsequent property declarations must have the same type. Property 'privateKey' must be of type 'CryptoKey', but here has type 'CryptoKey | undefined'. 89 privateKey?: CryptoKey; ~~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:3773:5 3773 privateKey: CryptoKey; ~~~~~~~~~~ 'privateKey' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:90:5 - error TS2687: All declarations of 'publicKey' must have identical modifiers. 90 publicKey?: CryptoKey; ~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:90:5 - error TS2717: Subsequent property declarations must have the same type. Property 'publicKey' must be of type 'CryptoKey', but here has type 'CryptoKey | undefined'. 90 publicKey?: CryptoKey; ~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:3774:5 3774 publicKey: CryptoKey; ~~~~~~~~~ 'publicKey' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:1193:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'DOMMatrixReadOnly' must be of type '{ new (init?: string | number[] | undefined): DOMMatrixReadOnly; prototype: DOMMatrixReadOnly; fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly; fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly; fromMatrix(other?: DOMMatrixInit | undefined): DOMMatrixReadOnly; toString(): string; }', but here has type '{ new (init?: string | number[] | undefined): DOMMatrixReadOnly; prototype: DOMMatrixReadOnly; fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly; fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly; fromMatrix(other?: DOMMatrixInit | undefined): DOMMatrixReadOnly; }'. 1193 declare var DOMMatrixReadOnly: { ~~~~~~~~~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:3995:13 3995 declare var DOMMatrixReadOnly: { ~~~~~~~~~~~~~~~~~ 'DOMMatrixReadOnly' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:1290:5 - error TS2375: Duplicate number index signature. 1290 [index: number]: string; ~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:1599:5 - error TS2375: Duplicate number index signature. 1599 [index: number]: File; ~~~~~~~~~~~~~~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:1673:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'FormData' must be of type '{ new (form?: HTMLFormElement | undefined): FormData; prototype: FormData; }', but here has type '{ new (): FormData; prototype: FormData; }'. 1673 declare var FormData: { ~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:5630:13 5630 declare var FormData: { ~~~~~~~~ 'FormData' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:2207:14 - error TS2717: Subsequent property declarations must have the same type. Property 'canvas' must be of type 'HTMLCanvasElement | OffscreenCanvas', but here has type 'OffscreenCanvas'. 2207 readonly canvas: OffscreenCanvas; ~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:9642:14 9642 readonly canvas: HTMLCanvasElement | OffscreenCanvas; ~~~~~~ 'canvas' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:2395:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'Notification' must be of type '{ new (title: string, options?: NotificationOptions | undefined): Notification; prototype: Notification; readonly maxActions: number; readonly permission: NotificationPermission; requestPermission(deprecatedCallback?: NotificationPermissionCallback | undefined): Promise<...>; }', but here has type '{ new (title: string, options?: NotificationOptions | undefined): Notification; prototype: Notification; readonly maxActions: number; readonly permission: NotificationPermission; }'. 2395 declare var Notification: { ~~~~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:11183:13 11183 declare var Notification: { ~~~~~~~~~~~~ 'Notification' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:4777:14 - error TS2717: Subsequent property declarations must have the same type. Property 'canvas' must be of type 'HTMLCanvasElement | OffscreenCanvas', but here has type 'OffscreenCanvas'. 4777 readonly canvas: OffscreenCanvas; ~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:17808:14 17808 readonly canvas: HTMLCanvasElement | OffscreenCanvas; ~~~~~~ 'canvas' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:5900:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'onmessage' must be of type '((this: Window, ev: MessageEvent) => any) | null', but here has type '((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any) | null'. 5900 declare var onmessage: ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any) | null; ~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:20013:13 20013 declare var onmessage: ((this: Window, ev: MessageEvent) => any) | null; ~~~~~~~~~ 'onmessage' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:5901:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'onmessageerror' must be of type '((this: Window, ev: MessageEvent) => any) | null', but here has type '((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any) | null'. 5901 declare var onmessageerror: ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any) | null; ~~~~~~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:20014:13 20014 declare var onmessageerror: ((this: Window, ev: MessageEvent) => any) | null; ~~~~~~~~~~~~~~ 'onmessageerror' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:5918:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'location' must be of type 'Location', but here has type 'WorkerLocation'. 5918 declare var location: WorkerLocation; ~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:19615:13 19615 declare var location: Location; ~~~~~~~~ 'location' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:5919:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'navigator' must be of type 'Navigator', but here has type 'WorkerNavigator'. 5919 declare var navigator: WorkerNavigator; ~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:19621:13 19621 declare var navigator: Navigator; ~~~~~~~~~ 'navigator' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:5920:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'onerror' must be of type 'OnErrorEventHandler', but here has type '((this: DedicatedWorkerGlobalScope, ev: ErrorEvent) => any) | null'. 5920 declare var onerror: ((this: DedicatedWorkerGlobalScope, ev: ErrorEvent) => any) | null; ~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:19820:13 19820 declare var onerror: OnErrorEventHandler; ~~~~~~~ 'onerror' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:5921:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'onlanguagechange' must be of type '((this: Window, ev: Event) => any) | null', but here has type '((this: DedicatedWorkerGlobalScope, ev: Event) => any) | null'. 5921 declare var onlanguagechange: ((this: DedicatedWorkerGlobalScope, ev: Event) => any) | null; ~~~~~~~~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:20012:13 20012 declare var onlanguagechange: ((this: Window, ev: Event) => any) | null; ~~~~~~~~~~~~~~~~ 'onlanguagechange' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:5922:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'onoffline' must be of type '((this: Window, ev: Event) => any) | null', but here has type '((this: DedicatedWorkerGlobalScope, ev: Event) => any) | null'. 5922 declare var onoffline: ((this: DedicatedWorkerGlobalScope, ev: Event) => any) | null; ~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:20015:13 20015 declare var onoffline: ((this: Window, ev: Event) => any) | null; ~~~~~~~~~ 'onoffline' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:5923:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'ononline' must be of type '((this: Window, ev: Event) => any) | null', but here has type '((this: DedicatedWorkerGlobalScope, ev: Event) => any) | null'. 5923 declare var ononline: ((this: DedicatedWorkerGlobalScope, ev: Event) => any) | null; ~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:20016:13 20016 declare var ononline: ((this: Window, ev: Event) => any) | null; ~~~~~~~~ 'ononline' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:5924:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'onrejectionhandled' must be of type '((this: Window, ev: PromiseRejectionEvent) => any) | null', but here has type '((this: DedicatedWorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null'. 5924 declare var onrejectionhandled: ((this: DedicatedWorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null; ~~~~~~~~~~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:20020:13 20020 declare var onrejectionhandled: ((this: Window, ev: PromiseRejectionEvent) => any) | null; ~~~~~~~~~~~~~~~~~~ 'onrejectionhandled' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:5925:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'onunhandledrejection' must be of type '((this: Window, ev: PromiseRejectionEvent) => any) | null', but here has type '((this: DedicatedWorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null'. 5925 declare var onunhandledrejection: ((this: DedicatedWorkerGlobalScope, ev: PromiseRejectionEvent) => any) | null; ~~~~~~~~~~~~~~~~~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:20022:13 20022 declare var onunhandledrejection: ((this: Window, ev: PromiseRejectionEvent) => any) | null; ~~~~~~~~~~~~~~~~~~~~ 'onunhandledrejection' was also declared here. node_modules/vue-tsc/typescript/lib/lib.webworker.d.ts:5929:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'self' must be of type 'Window & typeof globalThis', but here has type 'WorkerGlobalScope & typeof globalThis'. 5929 declare var self: WorkerGlobalScope & typeof globalThis; ~~~~ node_modules/vue-tsc/typescript/lib/lib.dom.d.ts:19675:13 19675 declare var self: Window & typeof globalThis; ~~~~ 'self' was also declared here. Found 26 errors. ```
johnsoncodehk commented 3 years ago

This is same output with executing tsc --noEmit, it's not vue-tsc problem. I think "webworker" is conflict with your other settings in lib section.

Ky6uk commented 3 years ago

@johnsoncodehk Thanks, I haven't tested with tsc. It looks like the problem exists for years in TypeScript.