mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-23 07:07:09 -05:00
Add test case for intersection/constraint bug fixed in 4.9 (#54972)
This commit is contained in:
19
tests/cases/compiler/intersectionSatisfiesConstraint.ts
Normal file
19
tests/cases/compiler/intersectionSatisfiesConstraint.ts
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user