dudykr / stc

Speedy TypeScript type checker
https://stc.dudy.dev
Apache License 2.0
5.77k stars 166 forks source link

Requires an actual type operation.(2322 extra error) #1090

Open sunrabbit123 opened 1 year ago

sunrabbit123 commented 1 year ago
// @strict: true
// @declaration: true

function f2<T extends string | undefined>(x: T, y: NonNullable<T>) {
    x = y;
    y = x;  // Error
    let s1: string = x;  // Not error, because `actual_type` of `x` is `string` from `x = y`
    let s2: string = y;
}