🔎 Search Terms
silent never type return type inference alias propagating anonymous object
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
https://www.typescriptlang.org/play/?ts=6.0.0-dev.20250827#code/JYOwLgpgTgZghgYwgAgAoB4AqA+ZBvAKGWTAAsIQAuZACgHsQYBXAGxmBZYgBNqaA3OCyYRqmAJTIAvLiYgA1iDoB3EJJnI5ilSADcBAL4ECoSLEQpUAYQYBnMFCYIwdKPiLIQEZcizYaEAAeEAhMLlB8UBC2dCz8orSCwgkS0rj8dMDc6umZ2dQYOPpGBNwhLHBRyIJuqAU2IPaOzq76peWVKMwgzsAMyDB0dACMfjSBfDlo6HjIZfCsYGLIBtjiYm0IdmDIUbaLw9IDQ8M0NFOExFFgTFAgnt5oZ3ux8RceV9GvEPrExAD0-2QAD0APweAziYpQ4xgACeAAcUAB1YBkAAiEAWLDAfiOs3mcEWywMbTKCAqVW6vX6gzoACYxhNaFMMKiMViiTi-GsNsYto0dntFvSjnT6Wd3p8bncHj5UM8vnEIFK-i9lb8-oCQeDiJDoWSOlS5DT7nSAMxMyZpaYAbUwAF1echMJttrtootzWKhubJTbLh6ZfcvPLFTFlarPhH4pqAUCwRCYfrjOTKV0TWA+mahgAWK0sm0YAmc4n4ZAIqB0BEklbO13893CnG5n10XP+jSB663EOPBU0dVvAMfD0xn6j7WJvXJmHtCmdAaZ7PHOgAVgL5yLMzmpZx1HtDrr6xdbsFY8Wa7ba87uG7EGDcqeg6Vw67o6HE7+yCnupWs90IA
💻 Code
interfaceP<T>{then: (onfulfilled: (value: T)=>unknown)=>unknown;}interfacePConstructor{new<T>(executor: (resolve: (value: T)=>void)=>void): P<T>;}declarevarP: PConstructor;declarefunctionfoo1<T>(x: ()=>P<{default: T}>): T;constresult1=foo1(()=>{returnnewP((resolve)=>{resolve;});});typeWithDefault<T>={default: T};declarefunctionfoo2<T>(x: ()=>P<WithDefault<T>>): T;constresult2=foo2(()=>{returnnewP((resolve)=>{resolve;});});declarefunctionfoo3<T>(x: ()=>P<[T]>): T;constresult3=foo3(()=>{returnnewP((resolve)=>{resolve;});});declarefunctionfoo4<T>(x: ()=>P<{default: {prop: T}}>): T;constresult4=foo4(()=>{returnnewP((resolve)=>{resolve;});});declarefunctionfoo5<T>(x: ()=>P<{default: [T]}>): T;constresult5=foo5(()=>{returnnewP((resolve)=>{resolve;});});🙁 Actual behavior
Only foo2 and foo3 have errors and we can see that their inner resolves reference never
🙂 Expected behavior
All of those should consistently error and resolve should be typed as (value: unknown) => void. Specifically, foo1 and foo2 are the almost the same signatures but foo2 is using a type alias in its declaration which changes the inference behavior. This is strong indication of the bug here
Additional information about the issue
No response
🔎 Search Terms
silent never type return type inference alias propagating anonymous object
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?ts=6.0.0-dev.20250827#code/JYOwLgpgTgZghgYwgAgAoB4AqA+ZBvAKGWTAAsIQAuZACgHsQYBXAGxmBZYgBNqaA3OCyYRqmAJTIAvLiYgA1iDoB3EJJnI5ilSADcBAL4ECoSLEQpUAYQYBnMFCYIwdKPiLIQEZcizYaEAAeEAhMLlB8UBC2dCz8orSCwgkS0rj8dMDc6umZ2dQYOPpGBNwhLHBRyIJuqAU2IPaOzq76peWVKMwgzsAMyDB0dACMfjSBfDlo6HjIZfCsYGLIBtjiYm0IdmDIUbaLw9IDQ8M0NFOExFFgTFAgnt5oZ3ux8RceV9GvEPrExAD0-2QAD0APweAziYpQ4xgACeAAcUAB1YBkAAiEAWLDAfiOs3mcEWywMbTKCAqVW6vX6gzoACYxhNaFMMKiMViiTi-GsNsYto0dntFvSjnT6Wd3p8bncHj5UM8vnEIFK-i9lb8-oCQeDiJDoWSOlS5DT7nSAMxMyZpaYAbUwAF1echMJttrtootzWKhubJTbLh6ZfcvPLFTFlarPhH4pqAUCwRCYfrjOTKV0TWA+mahgAWK0sm0YAmc4n4ZAIqB0BEklbO13893CnG5n10XP+jSB663EOPBU0dVvAMfD0xn6j7WJvXJmHtCmdAaZ7PHOgAVgL5yLMzmpZx1HtDrr6xdbsFY8Wa7ba87uG7EGDcqeg6Vw67o6HE7+yCnupWs90IA
💻 Code
🙁 Actual behavior
Only
foo2andfoo3have errors and we can see that their innerresolves referencenever🙂 Expected behavior
All of those should consistently error and
resolveshould be typed as(value: unknown) => void. Specifically,foo1andfoo2are the almost the same signatures butfoo2is using a type alias in its declaration which changes the inference behavior. This is strong indication of the bug hereAdditional information about the issue
No response