Skip to content

Deriving namespace of types #9102

Closed
Closed

Description

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'.

Activity

  1. falsandtru commented on Jun 12, 2016

    @falsandtru
    ContributorAuthor

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

    cc Ryan Cavanaugh (@RyanCavanaugh)

  2. mhegazy commented on Jun 13, 2016

    @mhegazy
    Contributor

    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.

  3. falsandtru commented on Jun 14, 2016

    @falsandtru
    ContributorAuthor

    Is your comment a deciding of design for this proposal?

  4. mhegazy commented on Jun 14, 2016

    @mhegazy
    Contributor

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

  5. falsandtru commented on Jun 14, 2016

    @falsandtru
    ContributorAuthor

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

  6. mhegazy commented on Jun 14, 2016

    @mhegazy
    Contributor

    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.

  7. falsandtru commented on Jun 14, 2016

    @falsandtru
    ContributorAuthor

    So I'll create this proposal.

  8. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions