TypeScript Version: 2.0.9
Code
classBase{protectedconstructor(){}publicinstance1=newBase();// allowed}classSubclassextendsBase{publicinstance1_1=newBase();// allowedpublicinstance1_2=newSubclass();// allowed}classSubclassOfSubclassextendsSubclass{publicinstance2_1=newBase();// errorpublicinstance2_2=newSubclass();// errorpublicinstance2_3=newSubclassOfSubclass();// error}Expected behavior:
Calling a protected constructor of a parent's parent is allowed.
Actual behavior:
test.ts(12,26): error TS2674: Constructor of class 'Base' is protected and only accessible within the class declaration.
test.ts(13,26): error TS2674: Constructor of class 'Base' is protected and only accessible within the class declaration.
test.ts(14,26): error TS2674: Constructor of class 'Base' is protected and only accessible within the class declaration.
TypeScript Version: 2.0.9
Code
Expected behavior:
Calling a protected constructor of a parent's parent is allowed.
Actual behavior:
test.ts(12,26): error TS2674: Constructor of class 'Base' is protected and only accessible within the class declaration.
test.ts(13,26): error TS2674: Constructor of class 'Base' is protected and only accessible within the class declaration.
test.ts(14,26): error TS2674: Constructor of class 'Base' is protected and only accessible within the class declaration.