Simple answer :
class MyClass {}
const instance = new MyClass();
console.log(instance.constructor.name); // MyClass
console.log(MyClass.name); // MyClass
However: beware that the name will likely be different when using minified code.
More Related Contents:
- Is there a `valueof` similar to `keyof` in TypeScript?
- Generic type to get enum keys as union string in typescript?
- How do I dynamically assign properties to an object in TypeScript?
- Create a new object from type parameter in generic class
- Does Typescript support the ?. operator? (And, what’s it called?)
- How can I listen for keypress event on the whole page?
- Get properties of a class
- Select based on enum in Angular2
- ‘Cannot redeclare block-scoped variable’ in unrelated files
- typescript template literal as interface key
- How to undestand relations between types any, unknown, {} and between them and other types?
- Typescript Function with Generic Return Type
- Difference between extending and intersecting interfaces in TypeScript?
- How to do runtime type casting in TypeScript?
- How can moment.js be imported with typescript?
- How can an object type with nested subproperties be flattened?
- Accessing properties in union types
- How can I remove a wider type from a union type without removing its subtypes in TypeScript?
- Generating typescript declaration files from javascript
- ts An async function or method in ES5/ES3 requires the ‘Promise’ constructor
- How to declare a function that throws an error in Typescript
- How to use enum as index key type in typescript?
- How to share code between TypeScript projects?
- How to make Typescript infer the keys of an object but define type of its value?
- Is there ArgumentsType like ReturnType in Typescript?
- Typescript: Remove entries from tuple type
- Check if object correctly implements interface
- Is it possible to narrow the types of overloaded parameters without exhaustively checking each parameter in the function body?
- What are the differences between the private keyword and private fields in TypeScript?
- TypeScript: deep partial?