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
classX{}declareinterfaceConstructorAnyArgs<TClass>{new(...args: any[]): TClass}functionfoo(): ConstructorAnyArgs<X>{return}functionboo(): ConstructorAnyArgs<X>&{superclass: any}{return}letY=foo()lety=newY()letZ=boo()letz=newZ()// Cannot use 'new' with an expression whose type lacks a call or construct signature.
tsc: 2.4.2
http://www.typescriptlang.org/play/index.html#src=class%20X%20%7B%20%7D%0D%0Adeclare%20interface%20ConstructorAnyArgs%3CTClass%3E%20%7B%0D%0A%20%20%20%20new%20(...args%3A%20any%5B%5D)%3A%20TClass%0D%0A%7D%0D%0A%0D%0A%0D%0Afunction%20foo()%3A%20ConstructorAnyArgs%3CX%3E%20%7B%20return%20%7D%0D%0Afunction%20boo()%3A%20ConstructorAnyArgs%3CX%3E%20%26%20%7B%20superclass%3A%20any%20%7D%20%7B%20return%20%7D%0D%0A%0D%0Alet%20Y%20%3D%20foo()%0D%0Alet%20y%20%3D%20new%20Y()%0D%0A%0D%0Alet%20Z%20%3D%20boo()%0D%0Alet%20z%20%3D%20new%20Z()%20%2F%2F%20Cannot%20use%20'new'%20with%20an%20expression%20whose%20type%20lacks%20a%20call%20or%20construct%20signature.%0D%0A