Closed as not planned
Closed as not planned
Description
Bug Report
π Search Terms
never
π Version & Regression Information
- This changed between versions 5.0.4 and 5.1.0-dev.20230413
β― Playground Link
Playground link with relevant code
π» Code
type BaseParams = {foo: string}
type OriginalParams<T> = T extends undefined ? [BaseParams?] : [BaseParams & T]
declare const optionalParam: (...params: OriginalParams<undefined>) => void
declare const noParam: (...params: OriginalParams<never>) => void
optionalParam()
optionalParam({foo: 'bar'})
// Argument of type '[]' is not assignable to parameter of type 'never'.(2345)
// Works in TS 5.0
noParam()
type StillBrokenParamsImpl<T> = T extends never ? [] : [true]
type NeverIn50AsWell = StillBrokenParamsImpl<never>
// ^?
// should be [] to be useable as function parameter type
type Test = StillBrokenParamsImpl<undefined>
// ^?
// expected: type Test = [true]
π Actual behavior
never
as a type for function parameters not usable to indicate "no arguments allowed"
π Expected behavior
Some way to produce a type that results in no function arguments allowed. We used to do this with FunctionParams<never>
but now it's no longer clear how to do it since AnyGenery<never>
already produced never
in TS 5.0