You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeC1=abstractnew(a: 1)=>1typeC2=new(a: 2)=>2interfaceAextendsC1,C2{}// Error: Cannot assign an abstract constructor type to a non-abstract constructor type.interfaceBextendsC2,C1{}// Okdeclareleta: Adeclareletb: B// These are both effectively abstractnewa(1),newa(2),newb(1),newb(2)a=b// Okb=a// Error: Cannot assign an abstract constructor type to a non-abstract constructor type.typeAbstractFirst=C1&C2typeAbstractLast=C2&C1declareletabstractFirst: AbstractFirstdeclareletabstractLast: AbstractLast// These are assignable to each oherabstractFirst=abstractLastabstractLast=abstractFirstb=abstractFirst// Error: Cannot assign an abstract constructor type to a non-abstract constructor type.abstractFirst=b// Okb=abstractLast// OkabstractLast=b// Ok
🙁 Actual behavior
It seems that interfaces with both abstract and regular constructor overloads are only assignable from types with non-abstract first constructor overload.
🙂 Expected behavior
I don't expect any difference here.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
bgenia
changed the title
Overload order affects assignability of abstract constructors extended with regular constructors between type aliases and interfaces
Overload order affects assignability of abstract constructors overloaded with regular constructors in interfaces
Sep 9, 2024
🔎 Search Terms
abstract constructors, constructor overloading, overload order, intersection, type aliases, interfaces, assignability
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?noUncheckedIndexedAccess=true&ts=5.7.0-dev.20240904#code/C4TwDgpgBAwgjFAvFAhgIwM7AE4oMbBQB2EA7lABQoBcUcAlEgHx0BQoksATEsWZTShdGiFl1asAlkWARsAM3zQAglAgAPWUQAmGWHAA03KAG8AvlAD0lqAFFs2APbZaMFESKPCKDBkkBzIlQg9CxcAig8RyIwgFcCZygOaGBHVGJogFpQnHxCKJiceNTsJPAIADopGTlFPGgAITVNCB09GC4jeFMLaygAeQBrCW0IPAAbFGxocYhvWmVWUYmpmbmoNFoGiT6AFQALCAxoVY2vfbV5eTHgSQA3CHGQVExcglYSchQKBiNP1Aowj+-DQP3owPIoOEEhQvDQVhsQ1Y8OQsL69icLlg7k83l8ARCIVe4Xy0TiCVKySSaVhniI2WJeUiZKKFLKkCq7HKUGUjIIADFJNgsLxugAybhczi8sJ5AAyPkIyA6UAl8BGY0m0ygs28fOAguFwAW+sNWCWmtOupesoICqwJttwHtwB2NgORxO2p8fkC6Fm1LU+AujkO2FYORJZqVNrezsVEf1Lt4kby0YkKNjUaFIvRDmcrhxXlQ+MCwSzTIK5JK7JSNIy9NTESrrJrySqTYNOZj8L6SORKaTioRA2GneTyF7iOGQA
💻 Code
🙁 Actual behavior
It seems that interfaces with both abstract and regular constructor overloads are only assignable from types with non-abstract first constructor overload.
🙂 Expected behavior
I don't expect any difference here.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: