Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TReturn/TNext to Iterable et al #58243

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Conversation

rbuckton
Copy link
Member

@rbuckton rbuckton commented Apr 18, 2024

We avoided making this change in the past as it was very breaky, but at some point we need to address this discrepancy. Having incorrect types here is also causing problems with properly typing the Iterator Helpers proposal.

This also adds a new BuiltinIteratorReturn intrinsic type whose actual type is determined by the state of a new strictBuiltinIteratorReturn compiler option:

  • "strictBuiltinIteratorReturn": false - any (emulates current behavior for IterableIterator)
  • "strictBuiltinIteratorReturn": true - undefined

The strictBuiltinIteratorReturn is a strict option flag, meaning that it is enabled automatically when you set "strict": true in your tsconfig.json.

The new BuiltinIteratorReturn type is passed as the TReturn type argument for built-ins using IterableIterator or AsyncIterableIterator to enable stricter checks against the result of calling next() on the iterator.

Enabling strictBuiltinIteratorReturn results in a more accurate and type-safe return type for the next() methods of iterators produced by built-ins like Array, Set, Map, etc.:

// @strictBuiltinIteratorReturn: false
// NOTE: matches current behavior

const set = new Set(["a"]);
const result = set.keys().next();
//    ^?  result: IteratorResult<string, any>
const value = result.value;
//    ^?  value: any

if (!result.done) {
  const value = result.value;
  //    ^?  value: string
} else {
  const value = result.value;
  //    ^?  value: any
}

vs

// @strictBuiltinIteratorReturn: true

const set = new Set(["a"]);
const result = set.keys().next();
//    ^?  result: IteratorResult<string, undefined>
const value = result.value;
//    ^?  value: string | undefined

if (!result.done) {
  const value = result.value;
  //    ^?  value: string
} else {
  const value = result.value;
  //    ^?  value: undefined
}

Since this is a strict flag, there is a fair amount of existing code that will likely produce new compilation errors as a result of this change:

// @strict: true

function only<T>(set: Set<T>): T {
  if (set.size !== 1) throw new TypeError();
  return set.keys().next().value; // worked previously since result was `any`, but is now an error
}

This now fails as there is no correlation between set.size and the iterator produced by keys(), so the compiler is unaware that this constraint has been validated. If you are certain iterator will always yield at least one value, you can use a non-null assertion operator to strip off the | undefined:

// @strict: true

function only<T>(set: Set<T>): T {
  if (set.size !== 1) throw new TypeError();
  return set.keys().next().value!;
}

A follow-on PR to TypeScript-DOM-lib-generator can be found here: microsoft/TypeScript-DOM-lib-generator#1713

DefinitelyTyped breaks will be addressed by DefinitelyTyped/DefinitelyTyped#69632

Fixes #33353
Fixes #52998
Fixes #43750
Supersedes #56517
Related #58222

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Apr 18, 2024
@rbuckton

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@rbuckton

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@rbuckton

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@rbuckton

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@rbuckton

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@typescript-bot

This comment was marked as outdated.

@rbuckton
Copy link
Member Author

rbuckton commented Apr 19, 2024

Hey @rbuckton, the results of running the DT tests are ready.

There were interesting changes:

Changes are too big to display here, please check the log.

You can check the log here.

@jakebailey, @weswigham: Am I missing something? The bot says there were interesting changes but it links to a clean pipeline result.

@typescript-bot
Copy link
Collaborator

@rbuckton Here are the results of running the top 400 repos comparing main and refs/pull/58243/merge:

Something interesting changed - please have a look.

Details

apollographql/apollo-client

1 of 12 projects failed to build with the old tsc and were ignored

src/tsconfig.json

backstage/backstage

7 of 13 projects failed to build with the old tsc and were ignored

packages/cli/templates/default-react-plugin-package/tsconfig.json

continuedev/continue

3 of 5 projects failed to build with the old tsc and were ignored

extensions/vscode/tsconfig.json

danny-avila/LibreChat

2 of 4 projects failed to build with the old tsc and were ignored

packages/data-provider/tsconfig.json

discordjs/discord.js

38 of 62 projects failed to build with the old tsc and were ignored

packages/collection/tsconfig.json

packages/collection/tsconfig.eslint.json

packages/collection/tsconfig.docs.json

gcanti/fp-ts

4 of 5 projects failed to build with the old tsc and were ignored

tsconfig.build-es6.json

glideapps/quicktype

7 of 9 projects failed to build with the old tsc and were ignored

packages/quicktype-core/tsconfig.json

ionic-team/ionic-framework

19 of 20 projects failed to build with the old tsc and were ignored

core/tsconfig.json

microsoft/vscode

4 of 54 projects failed to build with the old tsc and were ignored

src/tsconfig.tsec.json

src/tsconfig.monaco.json

src/tsconfig.json

extensions/jake/tsconfig.json

extensions/gulp/tsconfig.json

extensions/grunt/tsconfig.json

nextui-org/nextui

2 of 80 projects failed to build with the old tsc and were ignored

packages/hooks/use-aria-multiselect/tsconfig.json

packages/core/react/tsconfig.json

packages/components/select/tsconfig.json

subquery/subql

2 of 6 projects failed to build with the old tsc and were ignored

tsconfig.json

trpc/trpc

28 of 35 projects failed to build with the old tsc and were ignored

packages/server/tsconfig.json

packages/server/tsconfig.benchmark.json

packages/react-query/tsconfig.json

packages/next/tsconfig.watch.json

packages/next/tsconfig.json

packages/client/tsconfig.json

vuejs/core

4 of 5 projects failed to build with the old tsc and were ignored

tsconfig.build-browser.json

@rbuckton
Copy link
Member Author

Based on the last two runs, the following is a summary of the differences between undefined vs void as TReturn for built-in iterators across DT, our user tests, and the top 400 repos:

  1. undefined
    1. ✔️ Can be forcibly ignored using postfix-!
    2. ❌ Requires an argument to call iter.return().
    3. ✔️ No problem with assignability to T | undefined.
    4. ❌ Assignability errors in interface implementations and subclasses.
  2. void
    1. ✔️ Can be forcibly ignored using postfix-!
    2. ✔️ Doesn't require an argument to call iter.return().
    3. T | void is not assignable to T | undefined.

I think the assignability issues in (1.iv) are far more problematic than those in (2.iii), as those in (2.iii) can be addressed with postfix-!, while those in (1.iv) cannot. This leads me to believe that continuing to use void over undefined as the return type for built-in iterators is probably the correct direction.

@Renegade334
Copy link
Contributor

Would it be possible to get a fresh packaged build?

@rbuckton
Copy link
Member Author

@typescript-bot: pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 23, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 23, 2024

Hey @rbuckton, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/161888/artifacts?artifactName=tgz&fileId=387AD8C8E1F027BBA0979C97CD7FF6178AF6EBBCB4A2286559BF650D82D0F4CB02&fileName=/typescript-5.5.0-insiders.20240523.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@Renegade334
Copy link
Contributor

Renegade334 commented May 27, 2024

For what it's worth:

  • ii. is related specifically to the generator fallback return type, rather than BuiltinIteratorReturn.
    • The return() argument being mandatory for non-void TReturn types is specific to Generators. It doesn't affect normal Iterators, since the argument to return() in the Iterator interface is defined as optional.
  • It doesn't look like the assignability error in iv. is genuine.
    • Digging through the pipeline output, the number of errors from the compilation hasn't changed. What's happened is that the mismatched types causing these errors have changed from Effect<void, unknown, unknown> to Effect<undefined, unknown, unknown> due to the change in generator fallback return type, and this is being reported by the workflow as a "new" error.
    • The errors in question are related to missing internal imports when compiling from that particular tsconfig, and aren't actually related to iterators/generators.
    • It doesn't seem like there are any other assignability errors raised for that test run, other than those associated with iter.next().value possibly being undefined.

I wonder if it's worth considering a combination of the two approaches: keeping the generator body parsing behaviour as it is in 5.4 (with fallback return type void), but having BuiltinIteratorReturn as undefined. This would avoid the void-to-undefined assignability issues for builtin iterators specifically, while also avoiding breaky behaviour associated with changing the TReturn of non-returning generator functions from void to non-void.

@rbuckton
Copy link
Member Author

  • ii. is related specifically to the generator fallback return type, rather than BuiltinIteratorReturn.

    • The return() argument being mandatory for non-void TReturn types is specific to Generators. It doesn't affect normal Iterators, since the argument to return() in the Iterator interface is defined as optional.

I'm really not certain they should differ. Generator and IterableIterator are essentially the same, we only added Generator to avoid this specific break.

I wonder if it's worth considering a combination of the two approaches: keeping the generator body parsing behaviour as it is in 5.4 (with fallback return type void), but having BuiltinIteratorReturn as undefined. This would avoid the void-to-undefined assignability issues for builtin iterators specifically, while also avoiding breaky behaviour associated with changing the TReturn of non-returning generator functions from void to non-void.

One of the reasons for this change is to support the Iterator helpers proposal. One of the capabilities in that proposal is allowing users to subclass Iterator to provide a custom next() while gaining the benefits of the helpers:

class MyIterator extends Iterator {
  next() {
    ...
  }
}

Since custom iterators can have a meaningful TReturn, we should ensure we are consistent with generators in the base case.

@rbuckton
Copy link
Member Author

It doesn't look like the assignability error in iv. is genuine.

  • Digging through the pipeline output, the number of errors from the compilation hasn't changed. What's happened is that the mismatched types causing these errors have changed from Effect<void, unknown, unknown> to Effect<undefined, unknown, unknown> due to the change in generator fallback return type, and this is being reported by the workflow as a "new" error.

It is not just effect, there are also assignability errors for fp-ts, puppeteer, and webpack.

@rbuckton
Copy link
Member Author

@typescript-bot run dt
@typescript-bot test top400
@typescript-bot test tsserver top100
@typescript-bot user test this
@typescript-bot user test tsserver

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 25, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
run dt ✅ Started 👀 Results
test top400 ✅ Started ✅ Results
test tsserver top100 ✅ Started ✅ Results
user test this ✅ Started 👀 Results
user test tsserver ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

@rbuckton Here are the results of running the top 400 repos with tsc comparing main and refs/pull/58243/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

@rbuckton Here are the results of running the user tests with tsserver comparing main and refs/pull/58243/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

@rbuckton Here are the results of running the top 200 repos with tsserver comparing main and refs/pull/58243/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @rbuckton, the results of running the DT tests are ready.

There were interesting changes:

Branch only errors:

Package: node/v16
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/node/v16/test/util_types.ts
  48:5  error  TypeScript@local tsconfig.dom.json, local tsconfig.non-dom.json expected type to be:
  Generator<unknown, any, unknown>
got:
  Generator<unknown, any, any>  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: node/v18
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/node/v18/test/test.ts
  563:1  error  TypeScript@local tsconfig.dom.json, local tsconfig.non-dom.json expected type to be:
  AsyncGenerator<"\n" | "." | "X", void, unknown>
got:
  AsyncGenerator<"\n" | "." | "X", void, any>  @definitelytyped/expect
  567:1  error  TypeScript@local tsconfig.dom.json, local tsconfig.non-dom.json expected type to be:
  AsyncGenerator<string, void, unknown>
got:
  AsyncGenerator<string, void, any>                      @definitelytyped/expect
  573:1  error  TypeScript@local tsconfig.dom.json, local tsconfig.non-dom.json expected type to be:
  AsyncGenerator<string, void, unknown>
got:
  AsyncGenerator<string, void, any>                      @definitelytyped/expect

/mnt/vss/_work/1/DefinitelyTyped/types/node/v18/test/util_types.ts
  48:5  error  TypeScript@local tsconfig.dom.json, local tsconfig.non-dom.json expected type to be:
  Generator<unknown, any, unknown>
got:
  Generator<unknown, any, any>  @definitelytyped/expect

✖ 4 problems (4 errors, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: node
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/node/test/test.ts
  665:1  error  TypeScript@local tsconfig.dom.json, local tsconfig.non-dom.json expected type to be:
  AsyncGenerator<"\n" | "." | "X", void, unknown>
got:
  AsyncGenerator<"\n" | "." | "X", void, any>  @definitelytyped/expect
  669:1  error  TypeScript@local tsconfig.dom.json, local tsconfig.non-dom.json expected type to be:
  AsyncGenerator<string, void, unknown>
got:
  AsyncGenerator<string, void, any>                      @definitelytyped/expect
  675:1  error  TypeScript@local tsconfig.dom.json, local tsconfig.non-dom.json expected type to be:
  AsyncGenerator<string, void, unknown>
got:
  AsyncGenerator<string, void, any>                      @definitelytyped/expect

/mnt/vss/_work/1/DefinitelyTyped/types/node/test/util_types.ts
  48:5  error  TypeScript@local tsconfig.dom.json, local tsconfig.non-dom.json expected type to be:
  Generator<unknown, any, unknown>
got:
  Generator<unknown, any, any>  @definitelytyped/expect

✖ 4 problems (4 errors, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: get-intrinsic
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/get-intrinsic/get-intrinsic-tests.ts
   34:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown>
got:
  AsyncGenerator<any, any, any>                          @definitelytyped/expect
   42:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown>
got:
  AsyncGenerator<any, any, any>                          @definitelytyped/expect
   98:5  error  TypeScript@local expected type to be:
  Generator<any, any, unknown>
got:
  Generator<any, any, any>                                    @definitelytyped/expect
  255:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown>
got:
  AsyncGenerator<any, any, any>                          @definitelytyped/expect
  263:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown>
got:
  AsyncGenerator<any, any, any>                          @definitelytyped/expect
  313:5  error  TypeScript@local expected type to be:
  Generator<any, any, unknown>
got:
  Generator<any, any, any>                                    @definitelytyped/expect
  470:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown> | undefined
got:
  AsyncGenerator<any, any, any> | undefined  @definitelytyped/expect
  478:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown> | undefined
got:
  AsyncGenerator<any, any, any> | undefined  @definitelytyped/expect
  528:5  error  TypeScript@local expected type to be:
  Generator<any, any, unknown> | undefined
got:
  Generator<any, any, any> | undefined            @definitelytyped/expect
  685:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown> | undefined
got:
  AsyncGenerator<any, any, any> | undefined  @definitelytyped/expect
  693:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown> | undefined
got:
  AsyncGenerator<any, any, any> | undefined  @definitelytyped/expect
  743:5  error  TypeScript@local expected type to be:
  Generator<any, any, unknown> | undefined
got:
  Generator<any, any, any> | undefined            @definitelytyped/expect

✖ 12 problems (12 errors, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: regenerator-runtime
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/regenerator-runtime/regenerator-runtime-tests.ts
  125:1  error  TypeScript@local expected type to be:
  { (): Generator<unknown, any, unknown>; <T>(...args: T[]): Generator<T, any, unknown>; } & GeneratorFunction
got:
  { (): Generator<unknown, any, any>; <T>(...args: T[]): Generator<T, any, any>; } & GeneratorFunction  @definitelytyped/expect
  132:1  error  TypeScript@local expected type to be:
  Generator<string | awrap<Promise<any>>, void, undefined>
got:
  Generator<string | awrap<Promise<any>>, void, any>                                                                                                        @definitelytyped/expect

✖ 2 problems (2 errors, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: es-get-iterator
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/es-get-iterator/es-get-iterator-tests.ts
   4:1  error  TypeScript@local expected type to be:
  Iterator<string, any, undefined>
got:
  Iterator<string, any, any>                                                                @definitelytyped/expect
   7:1  error  TypeScript@local expected type to be:
  Iterator<never, any, undefined>
got:
  Iterator<never, any, any>                                                                  @definitelytyped/expect
  10:1  error  TypeScript@local expected type to be:
  Iterator<number, any, undefined>
got:
  Iterator<number, any, any>                                                                @definitelytyped/expect
  13:1  error  TypeScript@local expected type to be:
  Iterator<string | number | boolean | undefined, any, undefined>
got:
  Iterator<string | number | boolean | undefined, any, any>  @definitelytyped/expect
  16:1  error  TypeScript@local expected type to be:
  Iterator<[symbol, unknown], any, undefined>
got:
  Iterator<[symbol, unknown], any, any>                                          @definitelytyped/expect
  19:1  error  TypeScript@local expected type to be:
  Iterator<boolean, any, undefined>
got:
  Iterator<boolean, any, any>                                                              @definitelytyped/expect
  36:1  error  TypeScript@local expected type to be:
  Iterator<any, any, undefined>
got:
  Iterator<any, any, any>                                                                      @definitelytyped/expect
  40:1  error  TypeScript@local expected type to be:
  Iterator<number, any, undefined> | Iterator<Date, any, undefined>
got:
  Iterator<number, any, any> | Iterator<Date, any, any>    @definitelytyped/expect
  44:1  error  TypeScript@local expected type to be:
  Iterator<[Error, DataView], any, undefined> | undefined
got:
  Iterator<[Error, DataView], any, any> | undefined                  @definitelytyped/expect
  48:1  error  TypeScript@local expected type to be:
  Iterator<unknown, any, undefined> | undefined
got:
  Iterator<unknown, any, any> | undefined                                      @definitelytyped/expect

✖ 10 problems (10 errors, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: bresenham
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/bresenham/bresenham-tests.ts
  12:1  error  TypeScript@local expected type to be:
  Generator<Point, any, unknown>
got:
  Generator<Point, any, any>  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: win-ca
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/win-ca/win-ca-tests.ts
  43:1  error  TypeScript@local expected type to be:
  void | AsyncGenerator<Certificate, any, unknown> | Generator<Certificate, any, unknown>
got:
  void | AsyncGenerator<Certificate, any, any> | Generator<Certificate, any, any>  @definitelytyped/expect
  53:1  error  TypeScript@local expected type to be:
  void | AsyncGenerator<Certificate, any, unknown> | Generator<Certificate, any, unknown>
got:
  void | AsyncGenerator<Certificate, any, any> | Generator<Certificate, any, any>  @definitelytyped/expect
  62:1  error  TypeScript@local expected type to be:
  void | AsyncGenerator<Certificate, any, unknown> | Generator<Certificate, any, unknown>
got:
  void | AsyncGenerator<Certificate, any, any> | Generator<Certificate, any, any>  @definitelytyped/expect
  65:1  error  TypeScript@local expected type to be:
  void | AsyncGenerator<Certificate, any, unknown> | Generator<Certificate, any, unknown>
got:
  void | AsyncGenerator<Certificate, any, any> | Generator<Certificate, any, any>  @definitelytyped/expect
  73:1  error  TypeScript@local expected type to be:
  void | AsyncGenerator<Certificate, any, unknown> | Generator<Certificate, any, unknown>
got:
  void | AsyncGenerator<Certificate, any, any> | Generator<Certificate, any, any>  @definitelytyped/expect
  75:1  error  TypeScript@local expected type to be:
  void | AsyncGenerator<Certificate, any, unknown> | Generator<Certificate, any, unknown>
got:
  void | AsyncGenerator<Certificate, any, any> | Generator<Certificate, any, any>  @definitelytyped/expect
  77:1  error  TypeScript@local expected type to be:
  void | AsyncGenerator<Certificate, any, unknown> | Generator<Certificate, any, unknown>
got:
  void | AsyncGenerator<Certificate, any, any> | Generator<Certificate, any, any>  @definitelytyped/expect
  79:1  error  TypeScript@local expected type to be:
  void | AsyncGenerator<Certificate, any, unknown> | Generator<Certificate, any, unknown>
got:
  void | AsyncGenerator<Certificate, any, any> | Generator<Certificate, any, any>  @definitelytyped/expect
  82:1  error  TypeScript@local expected type to be:
  void | AsyncGenerator<Certificate, any, unknown> | Generator<Certificate, any, unknown>
got:
  void | AsyncGenerator<Certificate, any, any> | Generator<Certificate, any, any>  @definitelytyped/expect
  86:1  error  TypeScript@local expected type to be:
  void | AsyncGenerator<Certificate, any, unknown> | Generator<Certificate, any, unknown>
got:
  void | AsyncGenerator<Certificate, any, any> | Generator<Certificate, any, any>  @definitelytyped/expect
  93:1  error  TypeScript@local expected type to be:
  Generator<Certificate, any, unknown>
got:
  Generator<Certificate, any, any>                                                                                                    @definitelytyped/expect
  95:1  error  TypeScript@local expected type to be:
  AsyncGenerator<Certificate, any, unknown>
got:
  AsyncGenerator<Certificate, any, any>                                                                                          @definitelytyped/expect

✖ 12 problems (12 errors, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

Package: es-abstract
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/es-abstract/test/GetIntrinsic.test.ts
   26:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown>
got:
  AsyncGenerator<any, any, any>                          @definitelytyped/expect
   34:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown>
got:
  AsyncGenerator<any, any, any>                          @definitelytyped/expect
   81:5  error  TypeScript@local expected type to be:
  Generator<any, any, unknown>
got:
  Generator<any, any, any>                                    @definitelytyped/expect
  235:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown>
got:
  AsyncGenerator<any, any, any>                          @definitelytyped/expect
  243:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown>
got:
  AsyncGenerator<any, any, any>                          @definitelytyped/expect
  290:5  error  TypeScript@local expected type to be:
  Generator<any, any, unknown>
got:
  Generator<any, any, any>                                    @definitelytyped/expect
  444:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown> | undefined
got:
  AsyncGenerator<any, any, any> | undefined  @definitelytyped/expect
  452:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown> | undefined
got:
  AsyncGenerator<any, any, any> | undefined  @definitelytyped/expect
  499:5  error  TypeScript@local expected type to be:
  Generator<any, any, unknown> | undefined
got:
  Generator<any, any, any> | undefined            @definitelytyped/expect
  653:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown> | undefined
got:
  AsyncGenerator<any, any, any> | undefined  @definitelytyped/expect
  661:5  error  TypeScript@local expected type to be:
  AsyncGenerator<any, any, unknown> | undefined
got:
  AsyncGenerator<any, any, any> | undefined  @definitelytyped/expect
  708:5  error  TypeScript@local expected type to be:
  Generator<any, any, unknown> | undefined
got:
  Generator<any, any, any> | undefined            @definitelytyped/expect

✖ 12 problems (12 errors, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@[email protected][email protected]/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

You can check the log here.

@typescript-bot
Copy link
Collaborator

@rbuckton Here are the results of running the user tests with tsc comparing main and refs/pull/58243/merge:

Something interesting changed - please have a look.

Details

azure-sdk

/mnt/ts_downloads/_/m/azure-sdk/build.sh

  • [NEW] error TS2345: Argument of type 'Uint8Array' is not assignable to parameter of type 'Buffer'.
    • /mnt/ts_downloads/_/m/azure-sdk/test/node/appendblobclient.spec.ts(448,46)

fp-ts

tsconfig.json

tsconfig.build-es6.json

dtslint/ts3.5/tsconfig.json

puppeteer

packages/puppeteer-core/tsconfig.json

pyright

/mnt/ts_downloads/_/m/pyright/build.sh

  • [NEW] error TS2345: Argument of type 'SortedMap<string, Inode>' is not assignable to parameter of type 'ReadonlyMap<string, Inode>'.
    • /mnt/ts_downloads/_/m/pyright/pyright-internal: src/tests/harness/vfs/filesystem.ts(909,69)
    • /mnt/ts_downloads/_/m/pyright/pyright-internal: src/tests/harness/vfs/filesystem.ts(1086,13)
    • /mnt/ts_downloads/_/m/pyright/pyright-internal: src/tests/harness/vfs/filesystem.ts(1137,17)
    • /mnt/ts_downloads/_/m/pyright/pyright-internal: src/tests/harness/vfs/filesystem.ts(1226,67)
    • /mnt/ts_downloads/_/m/pyright/pyright-internal: src/tests/harness/vfs/filesystem.ts(1337,39)
    • /mnt/ts_downloads/_/m/pyright/pyright-internal: src/tests/harness/vfs/filesystem.ts(1373,39)

webpack

tsconfig.types.json

  • [NEW] error TS2345: Argument of type 'Module | undefined' is not assignable to parameter of type 'Module'.
  • [NEW] error TS2322: Type 'CodeGenerationResult | undefined' is not assignable to type 'CodeGenerationResult'.
  • [NEW] error TS2322: Type 'undefined' is not assignable to type 'Pick<ArgumentConfig, "values" | "type">'.
  • [NEW] error TS2322: Type 'IterableIterator<[K, V], undefined> | undefined' is not assignable to type 'IterableIterator<[K, V], undefined>'.
  • [MISSING] error TS2322: Type 'undefined' is not assignable to type 'Pick<ArgumentConfig, "type" | "values">'.
  • [MISSING] error TS2322: Type 'IterableIterator<[K, V]> | undefined' is not assignable to type 'IterableIterator<[K, V]>'.

@Renegade334
Copy link
Contributor

Renegade334 commented Jun 27, 2024

It looks like top400 generated an empty repo list on the last run, so it didn't actually test anything.

(I guess the pipeline should probably check for this!)

@jakebailey
Copy link
Member

Hm, that's concerning.

@typescript-bot test top400

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 27, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the top 400 repos with tsc comparing main and refs/pull/58243/merge:

Something interesting changed - please have a look.

Details

angular/angular-cli

4 of 21 projects failed to build with the old tsc and were ignored

tests/legacy-cli/tsconfig.json

apollographql/apollo-client

1 of 12 projects failed to build with the old tsc and were ignored

src/tsconfig.json

continuedev/continue

extensions/vscode/tsconfig.json

danny-avila/LibreChat

3 of 4 projects failed to build with the old tsc and were ignored

packages/data-provider/tsconfig.json

discordjs/discord.js

39 of 62 projects failed to build with the old tsc and were ignored

packages/collection/tsconfig.json

packages/collection/tsconfig.eslint.json

packages/collection/tsconfig.docs.json

gcanti/fp-ts

4 of 5 projects failed to build with the old tsc and were ignored

tsconfig.build-es6.json

glideapps/quicktype

7 of 9 projects failed to build with the old tsc and were ignored

packages/quicktype-core/tsconfig.json

microsoft/vscode

4 of 54 projects failed to build with the old tsc and were ignored

src/tsconfig.tsec.json

src/tsconfig.monaco.json

src/tsconfig.json

extensions/jake/tsconfig.json

extensions/gulp/tsconfig.json

extensions/grunt/tsconfig.json

nextui-org/nextui

2 of 80 projects failed to build with the old tsc and were ignored

packages/hooks/use-aria-multiselect/tsconfig.json

packages/core/react/tsconfig.json

packages/components/select/tsconfig.json

subquery/subql

2 of 6 projects failed to build with the old tsc and were ignored

tsconfig.json

trpc/trpc

30 of 36 projects failed to build with the old tsc and were ignored

packages/server/tsconfig.benchmark.json

packages/react-query/tsconfig.json

packages/next/tsconfig.watch.json

packages/next/tsconfig.json

packages/client/tsconfig.json

vuejs/core

2 of 5 projects failed to build with the old tsc and were ignored

tsconfig.json

tsconfig.build-node.json

tsconfig.build-browser.json

@Renegade334
Copy link
Contributor

Renegade334 commented Jun 27, 2024

angular/angular-cli

4 of 21 projects failed to build with the old tsc and were ignored

tests/legacy-cli/tsconfig.json

* `error TS2416: Property '[Symbol.iterator]' in type 'PartiallyOrderedSet<T>' is not assignable to the same property in base type 'Set<T>'.`
  
  * [packages/angular_devkit/core/src/utils/partially-ordered-set.ts#L133](https://github.com/angular/angular-cli/blob/79821006b81a50fa983b33652a445e6debe0bf83/packages/angular_devkit/core/src/utils/partially-ordered-set.ts#L133)

Generator<T, void> not being assignable to Iterator<T, BuiltinIteratorReturn> is potentially a headache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Add a Flag Any problem can be solved by flags, except for the problem of having too many flags API Relates to the public API for TypeScript Author: Team Breaking Change Would introduce errors in existing code Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Status: Waiting on reviewers
PR Backlog
  
Not started
6 participants