-
Notifications
You must be signed in to change notification settings - Fork 868
Closed
Description
Steps to reproduce
- Start a plain new project, with
@typescript/native-preview@npm:7.0.0-dev.20260211.1as dependency. - Run
npx tsgo --initto get the default tsconfig. - Add a
src/main.ts& runnpx tsgo --noEmit.
// src/main.ts
declare let indices: RegExpIndicesArray;
let [[x, y]] = indices;Behavior with typescript@6.0
No error, as it should be. See https://tsplay.dev/mqb9ZW.
Behavior with tsgo
src/main.ts:4:6 - error TS2488: Type 'undefined' must have a '[Symbol.iterator]()' method that returns an iterator.
4 let [[x, y]] = indices;
~~
Found 1 error in src/main.ts:4
Note: The error is the same as if indices is of type indices | undefined. It seems only happen to RegExpIndicesArray, so I wonder if it is the case that tsgo cannot infer extended array element type correctly during spreading.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels