Skip to content

Emitting type parameters (regression) #31792

Closed
@falsandtru

Description

@falsandtru

TypeScript Version: master

Search Terms:

Code

export class MyMap<K, V> {
	constructor(
		private readonly Map_: typeof Map = Map
	) {
	}
	private readonly store = new this.Map_<K, V>();
}

Expected behavior:

export class MyMap {
    constructor(Map_ = Map) {
        this.Map_ = Map_;
        this.store = new this.Map_();
    }
}

Actual behavior:

export class MyMap {
    constructor(Map_ = Map) {
        this.Map_ = Map_;
        this.store = new this.Map_<K, V>();
    }
}

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issueHigh Priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions