-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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 NoInfer
intrinsic type
#52968
Add NoInfer
intrinsic type
#52968
Conversation
The TypeScript team hasn't accepted the linked issue #14829. If you can get it accepted, this PR will have a better chance of being reviewed. |
@Andarist did you learn anything interesting from the implementation? If so, can you add a report to the end of #14829? Unless @DanielRosenwasser @RyanCavanaugh or @ahejlsberg are interested in taking up this feature in a design meeting, it's likely that this PR will sit until it gets stale. |
@jakebailey would you mind creating a playground for this? :) |
@typescript-bot pack this |
Heya @jakebailey, I've started to run the tarball bundle task on this PR at 86448ff. You can monitor the build here. |
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
Hi, I am reading #14829 and trying to add An I notice the type type NoInfer<T> = T & { [K in keyof T]: T[K] }
type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[]
? RecursivePartial<U>[]
: T[P] extends Record<any, any>
? RecursivePartial<T[P]>
: T[P]
}
function foo(v: { a: number, b: string }) {}
function stub<T>(v: RecursivePartial<NoInfer<T>>): T { return v as T }
foo(stub({ a: 1 }) // error
// Argument of type '{ a: number; }' is not assignable to parameter of type '{ a: number; b: string; }'.
// Property 'b' is missing in type '{ a: number; }' but required in type '{ a: number; b: string; }'. It works with the following type: Just want to bring it up so that this test case is covered in your implementation. |
@RyanCavanaugh Since 5.2 development has started recently - perhaps we could get some current thoughts from the team about this feature? 😉 |
@typescript-bot pack this |
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up. |
Heya @andrewbranch, I've started to run the tarball bundle task on this PR at 989fa50. You can monitor the build here. |
Hey @andrewbranch, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
superseded by #56794 |
closes #14829
There is still some work to be done here (type displays on hover, assignability bug, and maybe more) - but I'm pushing this out to receive an early feedback
cc @RyanCavanaugh