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

FunctionConstructor doesn't have a name property #6623

Closed
tinganho opened this issue Jan 26, 2016 · 1 comment
Closed

FunctionConstructor doesn't have a name property #6623

tinganho opened this issue Jan 26, 2016 · 1 comment
Labels
By Design Deprecated - use "Working as Intended" or "Design Limitation" instead

Comments

@tinganho
Copy link
Contributor

I think there should exist typing for the name property below:

class A {
}
A.constructor.name // error

If I recall it correctly the name property of a function is readonly.

interface FunctionConstructor {
    /**
      * Creates a new function.
      * @param args A list of arguments the function accepts.
      */
    new (...args: string[]): Function;
    (...args: string[]): Function;
    prototype: Function;
    name: string; // added
}
@mhegazy mhegazy added the By Design Deprecated - use "Working as Intended" or "Design Limitation" instead label Jan 26, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Jan 26, 2016

the name property on interface Function is defined in lib.es6.d.ts. if you compile with --target ES6 you should see it. alternatively you can define it locally:

interface Function {
    name: string;
}

we are working on fixing up the lib/target interaction for the next release. see #4168

@mhegazy mhegazy closed this as completed Jan 26, 2016
@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
By Design Deprecated - use "Working as Intended" or "Design Limitation" instead
Projects
None yet
Development

No branches or pull requests

2 participants