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

Experiment: Remove lower priority from contextual signature instantiation return type inference #58321

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andrewbranch
Copy link
Member

No description provided.

@andrewbranch
Copy link
Member Author

@typescript-bot test top200

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 25, 2024

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

Command Status Results
test top200 ✅ Started

@andrewbranch
Copy link
Member Author

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 25, 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 Apr 25, 2024

Hey @andrewbranch, 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/161473/artifacts?artifactName=tgz&fileId=C723169543A40FB90A0107AC550ACF4D6B41276B124BA86254E134BF631E468F02&fileName=/typescript-5.5.0-insiders.20240425.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/pr-build@5.5.0-pr-58321-4".;

@andrewbranch
Copy link
Member Author

@typescript-bot test top200
@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 25, 2024

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

Command Status Results
test top200 ✅ Started 👀 Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 25, 2024

Hey @andrewbranch, 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/161474/artifacts?artifactName=tgz&fileId=0D50580727580C2B54AFD5A51B91EA4A6271481DD62F02A2B1CEE60EA09EF4C902&fileName=/typescript-5.5.0-insiders.20240425.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/pr-build@5.5.0-pr-58321-7".;

!!! error TS2322: Type '{ [K in keyof U]: Obj[K]; }' is not assignable to type '{ [x: string]: number; }'.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote this test to exercise a very specific inference code path in the PR that introduced it, so it's not grounded in a real world scenario, but I don't think the new error is worse? Maybe the connection between the error and the actual code is more surprising now just because we end up inferring T = { [x: string]: number } instead of T = U.

Maybe that's a separate problem with signature comparison: it's not immediately clear to users that we've done inference in order to compare two signatures, and it's not immediately clear what the result of that inference was.

@typescript-bot
Copy link
Collaborator

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

Something interesting changed - please have a look.

Details

gcanti/fp-ts

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

tsconfig.build-es6.json

  • error TS2345: Argument of type '<A>(a: A) => Either<E, NonNullable<A>>' is not assignable to parameter of type '(b: B | null | undefined) => Either<E, B & {}>'.
  • error TS2345: Argument of type '<A>(a: A) => HKT<F, Either<E, NonNullable<A>>>' is not assignable to parameter of type '(b: B | null | undefined) => HKT<F, Either<E, B & {}>>'.
  • error TS2322: Type '<A extends readonly unknown[]>(...eqs: { [K in keyof A]: Eq<A[K]>; }) => Eq<Readonly<A>>' is not assignable to type '<T extends readonly Eq<any>[]>(...eqs: T) => Eq<{ [K in keyof T]: T[K] extends Eq<infer A> ? A : never; }>'.
  • error TS2345: Argument of type '<A>(a: A) => Option<NonNullable<A>>' is not assignable to parameter of type '(b: B | null | undefined) => Option<B & {}>'.
  • error TS2345: Argument of type '<A>(a: A) => HKT<F, Option<NonNullable<A>>>' is not assignable to parameter of type '(b: B | null | undefined) => HKT<F, Option<B & {}>>'.
  • error TS2322: Type '<A extends readonly unknown[]>(...ords: { [K in keyof A]: Ord<A[K]>; }) => Ord<Readonly<A>>' is not assignable to type '<T extends readonly Ord<any>[]>(...ords: T) => Ord<{ [K in keyof T]: T[K] extends Ord<infer A> ? A : never; }>'.
  • error TS2322: Type '<A extends readonly unknown[]>(...shows: { [K in keyof A]: Show<A[K]>; }) => Show<Readonly<A>>' is not assignable to type '<T extends readonly Show<any>[]>(...shows: T) => Show<{ [K in keyof T]: T[K] extends Show<infer A> ? A : never; }>'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants