Skip to content

Make never rest type top-like - #35438

Merged
Wesley Wigham (weswigham) merged 4 commits into
microsoft:masterfrom
jack-williams:ground-function-type
Mar 30, 2020
Merged

Make never rest type top-like#35438
Wesley Wigham (weswigham) merged 4 commits into
microsoft:masterfrom
jack-williams:ground-function-type

Conversation

@jack-williams

@jack-williamsJack Williams (jack-williams) commented Dec 2, 2019

Copy link
Copy Markdown
Collaborator

Not an actual fix as the issue is still under discussion. Figured I’d put up and implementation though.

Fixes#33495

@jack-williams

Copy link
Copy Markdown
CollaboratorAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Dec 2, 2019

Copy link
Copy Markdown
Contributor

Heya Jack Williams (@jack-williams), I've started to run the extended test suite on this PR at 76bc82b. You can monitor the build here. It should now contribute to this PR's status checks.

@typescript-bot

TypeScript Bot (typescript-bot) commented Dec 2, 2019

Copy link
Copy Markdown
Contributor

Heya Jack Williams (@jack-williams), I've started to run the parallelized community code test suite on this PR at 76bc82b. You can monitor the build here. It should now contribute to this PR's status checks.

@typescript-bot

Copy link
Copy Markdown
Contributor

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes a lot of sense to me - making never behave as any already did here seems to work. Can we also see a test for the nested case, eg

functionassignmentWithComplexRest2<Textendsany[]>(){constfn1: (cb: (x: string, ...rest: T)=>void)=>void=(cb)=>{};constfn2: (cb: (...args: never)=>void)=>void=fn1;}

which should error, I believe?

@jack-williams

Copy link
Copy Markdown
CollaboratorAuthor

which should error, I believe?

Yep, added!

@sandersnNathan Shively-Sanders (sandersn) added the For Backlog Bug PRs that fix a backlog bug label Feb 3, 2020
@sandersnNathan Shively-Sanders (sandersn) added Experiment A fork with an experimental idea which might not make it into master For Uncommitted Bug PR for untriaged, rejected, closed or missing bug and removed For Backlog Bug PRs that fix a backlog bug Experiment A fork with an experimental idea which might not make it into master labels Mar 9, 2020
@jack-williams

Copy link
Copy Markdown
CollaboratorAuthor

Thanks for powering through all these PR's Nathan Shively-Sanders (@sandersn) and Wesley Wigham (@weswigham)!

@andrewbranch

Copy link
Copy Markdown
Member

Was it known that this makes (...args: never) => unknown callable? #48840

@jack-williams

Jack Williams (jack-williams) commented Apr 26, 2022

Copy link
Copy Markdown
CollaboratorAuthor

Short answer: no. That function type should not be callable.

Longer answer: After looking through this again last night and trying to fix it, I do vaguely remember looking at that behaviour before. I think the code to trigger the error was move involved and touched a couple of the signature checking functions. I guess I never got around to resolving that and when the PR was revived, I had forgotten.

I started working on a fix yesterday. Haven't run it through perf and regression test. I do not think it is a big change. Also happy for someone to pick it up.

@andrewbranch

Copy link
Copy Markdown
Member

Thanks Jack Williams (@jack-williams), wasn’t expecting you to pick up a fix, just searching for info, but appreciate it!

@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

never rest type not assignable to complex rest type

5 participants

@jack-williams@typescript-bot@andrewbranch@weswigham@sandersn