vue-next doesn't build on Typescript 4.1
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.