diff --git a/tests/cases/conformance/types/literal/literalTypeWidening.ts b/tests/cases/conformance/types/literal/literalTypeWidening.ts index 4c818793142..17daedb3b0e 100644 --- a/tests/cases/conformance/types/literal/literalTypeWidening.ts +++ b/tests/cases/conformance/types/literal/literalTypeWidening.ts @@ -127,3 +127,10 @@ export type LangCode = keyof typeof langCodeSet export const langCodes = keys(langCodeSet) const arr: Obj[] = langCodes.map(code => ({ code })) + +// Repro from #29081 + +function test(obj: T): T { + let { a, ...rest } = obj; + return { a: 'hello', ...rest } as T; +}