Add test case for intersection/constraint bug fixed in 4.9 (#54972)

This commit is contained in:
Jake Bailey
2023-07-13 16:04:42 -07:00
committed by GitHub
parent c468960578
commit 8a85b2aafb
4 changed files with 148 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
// @strict: true
// @lib: esnext
interface FirstInterface {
commonProperty: number
}
interface SecondInterface {
commonProperty: number
}
const myFirstFunction = <T extends FirstInterface | SecondInterface>(param1: T) => {
const newParam: T & { otherProperty: number } = Object.assign(param1, { otherProperty: 3 })
mySecondFunction(newParam)
}
const mySecondFunction = <T extends { commonProperty: number, otherProperty: number }>(newParam: T) => {
return newParam
}