Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ef2e1d9
Add TReturn/TNext to Iterable et al
rbuckton Apr 18, 2024
1a64ac9
Fix assignability checks, update baselines
rbuckton Apr 18, 2024
7aa2281
Fix lint
rbuckton Apr 18, 2024
be600a8
Revert incorrect lint fix
rbuckton Apr 18, 2024
afbfa69
Merge branch 'main' into iterator-default-return
rbuckton Apr 18, 2024
8182bfc
Fix failing tests
rbuckton Apr 18, 2024
ad451d1
Elide type arguments that match defaults for inferred Iterable et al
rbuckton Apr 19, 2024
ec82647
Set TReturn default to 'any', provide explicit type arguments where n…
rbuckton Apr 19, 2024
5cb0e10
Fix broken fourslash test
rbuckton Apr 19, 2024
52ed319
Use intrinsic type for builtin iterator return, PR feedback
rbuckton May 6, 2024
bb513be
Use BuiltinIteratorReturn in es2020.bigint and es2022.intl
rbuckton May 7, 2024
2d58aa5
Use BuiltinIteratorReturn in es2020.string and es2020.symbol.wellknown
rbuckton May 7, 2024
0bfb236
Update baselines
rbuckton May 7, 2024
e98303f
Use new --strictBuiltinIteratorReturn flag
rbuckton May 17, 2024
3a59acb
Merge branch 'main' into iterator-default-return
rbuckton May 17, 2024
8578a4d
Update baselines
rbuckton May 17, 2024
51151ee
Change default for 'TNext' to 'any'
rbuckton May 17, 2024
595707d
Change inferred return type of generators to 'undefined'
rbuckton May 20, 2024
2a4edbc
Revert and use 'void' for BuiltinIteratorReturn
rbuckton May 21, 2024
7d32efc
Merge branch 'main' into iterator-default-return
rbuckton May 23, 2024
db12e2f
Merge branch 'main' into iterator-default-return
rbuckton Jun 25, 2024
fe2ff63
Split the difference, only use 'undefined' for built-ins
rbuckton Jun 25, 2024
63bc5fb
Add test and address self-build issue
rbuckton Jun 26, 2024
eece783
Merge branch 'main' into iterator-default-return
rbuckton Jul 17, 2024
a0d5046
Merge branch 'main' into iterator-default-return
rbuckton Jul 17, 2024
2a6af13
Merge branch 'main' into iterator-default-return
rbuckton Jul 17, 2024
46eba67
Add isolatedDeclarations test
rbuckton Jul 18, 2024
b8f04f6
Fix typo in comment
rbuckton Jul 18, 2024
1a3669a
Move initialization of 'typeParameterCount'
rbuckton Jul 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix failing tests
  • Loading branch information
rbuckton committed Apr 18, 2024
commit 8182bfc3c44867ce35692fcf50cfe688a1aaacaa
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37202,7 +37202,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}

// The global Generator type doesn't exist, so report an error
resolver.getGlobalGeneratorType(/*reportErrors*/ true);
resolver.getGlobalIterableIteratorType(/*reportErrors*/ true);
return emptyObjectType;
}

Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/emitArrowFunctionES6.types
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ var p1 = ([a]) => { };
> : ^^^

var p2 = ([...a]) => { };
>p2 : ([...a]: Iterable<any>) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^
>([...a]) => { } : ([...a]: Iterable<any>) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^
>p2 : ([...a]: Iterable<any, void, undefined>) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>([...a]) => { } : ([...a]: Iterable<any, void, undefined>) => void
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>a : any[]
> : ^^^^^

Expand Down
10 changes: 0 additions & 10 deletions tests/baselines/reference/generatorReturnTypeFallback.3.errors.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
//// [tests/cases/conformance/generators/generatorReturnTypeFallback.3.ts] ////

=== generatorReturnTypeFallback.3.ts ===
// Do not allow generators to fallback to IterableIterator while in strictNullChecks mode if they need a type for the sent value.
// NOTE: In non-strictNullChecks mode, `undefined` (the default sent value) is assignable to everything.
function* f() {
>f : Symbol(f, Decl(generatorReturnTypeFallback.3.ts, 0, 0))

const x: string = yield 1;
>x : Symbol(x, Decl(generatorReturnTypeFallback.3.ts, 3, 9))
>x : Symbol(x, Decl(generatorReturnTypeFallback.3.ts, 1, 9))
}
7 changes: 2 additions & 5 deletions tests/baselines/reference/generatorReturnTypeFallback.3.types
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
//// [tests/cases/conformance/generators/generatorReturnTypeFallback.3.ts] ////

=== generatorReturnTypeFallback.3.ts ===
// Do not allow generators to fallback to IterableIterator while in strictNullChecks mode if they need a type for the sent value.
// NOTE: In non-strictNullChecks mode, `undefined` (the default sent value) is assignable to everything.
function* f() {
>f : () => {}
> : ^^^^^^^^
>f : () => IterableIterator<number, void, string>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

const x: string = yield 1;
>x : string
> : ^^^^^^
>yield 1 : any
> : ^^^
>1 : 1
> : ^
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/jsxChildrenWrongType.types
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Instantiation count: 1,000

interface PropsType {
children: [string, number?] | Iterable<boolean>;
>children : [string, number?] | Iterable<boolean>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>children : [string, number?] | Iterable<boolean, void, undefined>
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
declare class Foo extends React.Component<PropsType, {}> {}
>Foo : Foo
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/types.forAwait.es2018.2.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ types.forAwait.es2018.2.ts(16,15): error TS2488: Type 'AsyncIterable<number, voi
for (const x of asyncIterable) {
~~~~~~~~~~~~~
!!! error TS2488: Type 'AsyncIterable<number, void, undefined>' must have a '[Symbol.iterator]()' method that returns an iterator.
!!! related TS2773 types.forAwait.es2018.2.ts:14:21: Did you forget to use 'await'?
}
for (y of asyncIterable) {
~~~~~~~~~~~~~
!!! error TS2488: Type 'AsyncIterable<number, void, undefined>' must have a '[Symbol.iterator]()' method that returns an iterator.
!!! related TS2773 types.forAwait.es2018.2.ts:16:15: Did you forget to use 'await'?
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// @noemit: true
// @strict: true

// Do not allow generators to fallback to IterableIterator while in strictNullChecks mode if they need a type for the sent value.
// NOTE: In non-strictNullChecks mode, `undefined` (the default sent value) is assignable to everything.
function* f() {
const x: string = yield 1;
}