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

@smui/common - "Type 'CustomEvent<T | undefined>' is not assignable to type 'CustomEvent<T>'" error when strictNullChecks is enabled in tsconfig #530

Closed
DetachHead opened this issue Nov 4, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@DetachHead
Copy link
Contributor

Describe the bug
the following errors occur when running svelte-check with the strictNullChecks compiler option enabled in tsconfig.json:

c:\project\node_modules\@smui\common\src\internal\dispatch.ts:10:11
Error: Type 'CustomEvent<T | undefined>' is not assignable to type 'CustomEvent<T>'.
  Type 'T | undefined' is not assignable to type 'T'.
    'T | undefined' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown'.
      Type 'undefined' is not assignable to type 'T'.
        'undefined' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown'.
  if (typeof Event !== 'undefined' && element) {
    const event: CustomEvent<T> = new CustomEvent(eventType, {
      ...eventInit,


c:\project\node_modules\@smui\common\src\internal\dispatch.ts:16:13
Error: Type 'CustomEvent<T | undefined>' is not assignable to type 'CustomEvent<T>'.
    if (duplicateEventForMDC && eventType.startsWith('SMUI')) {
      const duplicateEvent: CustomEvent<T> = new CustomEvent(
        eventType.replace(/^SMUI/g, () => 'MDC'),

To Reproduce
Steps to reproduce the behavior:

  1. enable strictNullChecks in tsconfig.json:
    {
        "compilerOptions": {
            "strictNullChecks": true,
            "skipLibCheck": false
        }
    }
  2. run svelte-check

Expected behavior
no error

@DetachHead
Copy link
Contributor Author

after some investigating i noticed that this is caused by typesVersions in the @smui/common package incorrectly pointing to the source code. see #532

@DetachHead DetachHead closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant