A extends keyword derives only namespace of variables.
extends
TypeScript Version:
master
Code
class B { } namespace B { export type M = number; export var m = 0; } class D extends B {} var m: D.M = D.m;
Expected behavior:
$ node built/local/tsc.js index.ts
Actual behavior:
$ node built/local/tsc.js index.ts index.ts(8,8): error TS2503: Cannot find namespace 'D'.
If TypeScript derives namespace of types, I can use partial classes using mixins. #563 (comment)
cc Ryan Cavanaugh (@RyanCavanaugh)
This is working as intend. initially in 0.8.* extends would get you all the declarations but that seemed a lot like statics.
So the recommendation is to use statics if you want your declarations to be inherited, and use namespaces for augmentation to the current symbol.
Is your comment a deciding of design for this proposal?
I do not think there is new information to warrant a design reconsideration.
My description has a diff of behaviors. Or, what formats for proposals do you need?
A use-case description that is not possible today because of this issue.
So I'll create this proposal.
Activity
falsandtru commentedon Jun 12, 2016
If TypeScript derives namespace of types, I can use partial classes using mixins. #563 (comment)
cc Ryan Cavanaugh (@RyanCavanaugh)
mhegazy commentedon Jun 13, 2016
This is working as intend. initially in 0.8.* extends would get you all the declarations but that seemed a lot like statics.
So the recommendation is to use statics if you want your declarations to be inherited, and use namespaces for augmentation to the current symbol.
falsandtru commentedon Jun 14, 2016
Is your comment a deciding of design for this proposal?
mhegazy commentedon Jun 14, 2016
I do not think there is new information to warrant a design reconsideration.
falsandtru commentedon Jun 14, 2016
My description has a diff of behaviors. Or, what formats for proposals do you need?
mhegazy commentedon Jun 14, 2016
A use-case description that is not possible today because of this issue.
falsandtru commentedon Jun 14, 2016
So I'll create this proposal.