Skip to content

Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated #16786

@alan-agius4

Description

@alan-agius4

TypeScript Version: 2.4.1

Code

interface myModel {
	prop: <T>(update: T) => void;
}

class myClass {
	test<T>(model: T) {
		const x = {
			prop: (model: T) => {
				// do something
			}
		}
		this.test2(x);
	}

	test2(model: myModel) {
		
	}
}

Expected behavior:
no errors

Actual behavior:
Type 'T' is not assignable to type 'T'. Two different types with this name exist, but they are unrelated.

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