Closed
Description
π Search Terms
generic, infer, LSP, reference
π Version & Regression Information
v5.8.3
β― Playground Link
π’π’π’ TS Playground π’π’π’
π» Code
type SpecialString = `##${string}`
type Style = { foo?: SpecialString }
export interface StyleFn {
<T extends Style = Style>(styles: T): T[]
}
const style: StyleFn = (...styles) => styles
style({ foo: '##xx' }) // β hover fails, only the value
style({ foo: '##xx' } satisfies Style) // β
hover works
style({ foo: 'xx' }) // β
hover works
π Actual behavior
When calling a generic function that infers its type argument from an object parameter, the LSP fails to preserve the type reference, even though the typecheck works as expected.
- Hovering over the property value (someValue) inside the function call does not show the expected type.
- Go to Definition does not work. TypeScript cannot navigate to the original type definition.
- If the argument is explicitly asserted with
satisfies
, or if the line has a type error the reference works.


π Expected behavior
When calling a generic function that infers its type parameter from an object argument, the LSP should preserve type references for all inferred properties, even when no explicit type assertion (like satisfies) is used.
Additional information about the issue
No response