Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deriving namespace of types #9102

Closed
falsandtru opened this issue Jun 12, 2016 · 7 comments
Closed

Deriving namespace of types #9102

falsandtru opened this issue Jun 12, 2016 · 7 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@falsandtru
Copy link
Contributor

A extends keyword derives only namespace of variables.

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'.
@falsandtru
Copy link
Contributor Author

If TypeScript derives namespace of types, I can use partial classes using mixins. #563 (comment)

cc @RyanCavanaugh

@mhegazy
Copy link
Contributor

mhegazy commented 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.

@mhegazy mhegazy added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jun 13, 2016
@falsandtru
Copy link
Contributor Author

Is your comment a deciding of design for this proposal?

@mhegazy
Copy link
Contributor

mhegazy commented Jun 14, 2016

I do not think there is new information to warrant a design reconsideration.

@falsandtru
Copy link
Contributor Author

My description has a diff of behaviors. Or, what formats for proposals do you need?

@mhegazy
Copy link
Contributor

mhegazy commented Jun 14, 2016

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.

@falsandtru
Copy link
Contributor Author

So I'll create this proposal.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

3 participants