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

vue-next doesn't build on Typescript 4.1 #2218

Closed
sandersn opened this issue Sep 23, 2020 · 0 comments · Fixed by #2219
Closed

vue-next doesn't build on Typescript 4.1 #2218

sandersn opened this issue Sep 23, 2020 · 0 comments · Fixed by #2219

Comments

@sandersn
Copy link
Contributor

Version

3.0.0

Reproduction link

https://github.com/microsoft/TypeScript/pull/40156/files#diff-3ff86ade791953efc13be67665963d94

Steps to reproduce

Based on the TS user test dockerfile:

yarn add typescript@next --exact --dev --ignore-scripts -W
yarn
npm run build --production -- --types

What is expected?

No compile error.

What is actually happening?

Compile error:

Error: /vue-next/packages/reactivity/src/collectionHandlers.ts(24,3): semantic error TS2322: Type 'T | DeepReadonly<UnwrapNestedRefs<T & Record<any, any>>>' is not assignable to type 'T'.
  'T | DeepReadonly<UnwrapNestedRefs<T & Record<any, any>>>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown'.
    Type 'DeepReadonly<UnwrapNestedRefs<T & Record<any, any>>>' is not assignable to type 'T'.
      'DeepReadonly<UnwrapNestedRefs<T & Record<any, any>>>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown'.
        Type '(undefined & UnwrapNestedRefs<T & Record<any, any>>) | (null & UnwrapNestedRefs<T & Record<any, any>>) | ... 10 more ... | (UnwrapNestedRefs<...> extends Map<...> ? ReadonlyMap<...> : UnwrapNestedRefs<...> extends ReadonlyMap<...> ? ReadonlyMap<...> : UnwrapNestedRefs<...> extends WeakMap<...> ? WeakMap<...> : Unwra...' is not assignable to type 'T'.
          '(undefined & UnwrapNestedRefs<T & Record<any, any>>) | (null & UnwrapNestedRefs<T & Record<any, any>>) | ... 10 more ... | (UnwrapNestedRefs<...> extends Map<...> ? ReadonlyMap<...> : UnwrapNestedRefs<...> extends ReadonlyMap<...> ? ReadonlyMap<...> : UnwrapNestedRefs<...> extends WeakMap<...> ? WeakMap<...> : Unwra...' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown'.
            Type 'undefined & UnwrapNestedRefs<T & Record<any, any>>' is not assignable to type 'T'.
              'undefined & UnwrapNestedRefs<T & Record<any, any>>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown'.
                Type 'DeepReadonly<Ref<any> & T & Record<any, any>> | DeepReadonly<UnwrapRef<T & Record<any, any>>>' is not assignable to type 'T'.
                  'DeepReadonly<Ref<any> & T & Record<any, any>> | DeepReadonly<UnwrapRef<T & Record<any, any>>>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown'.
                    Type 'DeepReadonly<UnwrapRef<T & Record<any, any>>>' is not assignable to type 'T'.
                      'DeepReadonly<UnwrapRef<T & Record<any, any>>>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown'.
                        Type '(undefined & UnwrapRef<T & Record<any, any>>) | (null & UnwrapRef<T & Record<any, any>>) | (string & UnwrapRef<T & Record<any, any>>) | ... 9 more ... | (UnwrapRef<...> extends Map<...> ? ReadonlyMap<...> : UnwrapRef<...> extends ReadonlyMap<...> ? ReadonlyMap<...> : UnwrapRef<...> extends WeakMap<...> ? WeakMap<......' is not assignable to type 'T'.
                          '(undefined & UnwrapRef<T & Record<any, any>>) | (null & UnwrapRef<T & Record<any, any>>) | (string & UnwrapRef<T & Record<any, any>>) | ... 9 more ... | (UnwrapRef<...> extends Map<...> ? ReadonlyMap<...> : UnwrapRef<...> extends ReadonlyMap<...> ? ReadonlyMap<...> : UnwrapRef<...> extends WeakMap<...> ? WeakMap<......' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown'.
                            Type 'undefined & UnwrapRef<T & Record<any, any>>' is not assignable to type 'T'.
                              'undefined & UnwrapRef<T & Record<any, any>>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown'.
                                Type 'Readonly<unknown>' is not assignable to type 'T'.
                                  'Readonly<unknown>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown'.

It is basically the worst error. I am sorry.

I have a workaround ready.

yyx990803 pushed a commit that referenced this issue Sep 28, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant