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
classTextendsNumber{x=0;// use class instance fieldconstructor(n: number){consttemp=n**n;// do somethingsuper(temp);// not first statement}};console.log(newT(10).valueOf());
π Actual behavior
TSC raises error TS2376, claiming that super calls must be the first statement in a class, if a class uses the class instance field.
π Expected behavior
TSC removes the : number, and ends process.
Removing type annotations, this is otherwise perfectly valid ES.
Bug Report
π Search Terms
First statement must be super
π Version & Regression Information
β― Playground Link
Couldn't provide a link, TS playground wasn't working, I've opened microsoft/TypeScript-Website#1506
π» Code
π Actual behavior
TSC raises error TS2376, claiming that super calls must be the first statement in a class, if a class uses the class instance field.
π Expected behavior
TSC removes the
: number
, and ends process.Removing type annotations, this is otherwise perfectly valid ES.
Possibly related to #6908
The text was updated successfully, but these errors were encountered: