Closed
Description
Bug Report
π Search Terms
strictoptionalproperties, global
β― Playground Link
Playground link with relevant code (and enable strictOptionalProperties
)
π» Code
const w: Window = window;
π Actual behavior
test.ts:1:7 - error TS2322: Type 'Window & typeof globalThis' is not assignable to type 'Window'.
Types of property 'ontouchcancel' are incompatible.
Type '(((this: GlobalEventHandlers, ev: TouchEvent) => any) & ((this: Window, ev: TouchEvent) => any)) | null | undefined' is not assignable to type '((this: GlobalEventHandlers, ev: TouchEvent) => any) | null'.
Type 'undefined' is not assignable to type '((this: GlobalEventHandlers, ev: TouchEvent) => any) | null'.
1 const w: Window = window;
~
π Expected behavior
Usually, T & U
is assignable to T
.