-
-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Correctly handle ObjectTypeSpreadProperty in object type annotat…
…ions (#593) Co-authored-by: Daniel Tschinder <231804+danez@users.noreply.github.com>
- Loading branch information
1 parent
4fc5b21
commit 395f338
Showing
3 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
122 changes: 122 additions & 0 deletions
122
src/utils/__tests__/__snapshots__/getFlowType-test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`getFlowType handles ObjectTypeSpreadProperty 1`] = ` | ||
Object { | ||
"name": "signature", | ||
"raw": "{| apple: string, banana: string, ...OtherFruits |}", | ||
"signature": Object { | ||
"properties": Array [ | ||
Object { | ||
"key": "apple", | ||
"value": Object { | ||
"name": "string", | ||
"required": true, | ||
}, | ||
}, | ||
Object { | ||
"key": "banana", | ||
"value": Object { | ||
"name": "string", | ||
"required": true, | ||
}, | ||
}, | ||
Object { | ||
"key": "orange", | ||
"value": Object { | ||
"name": "string", | ||
"required": true, | ||
}, | ||
}, | ||
], | ||
}, | ||
"type": "object", | ||
} | ||
`; | ||
|
||
exports[`getFlowType handles ObjectTypeSpreadProperty from imported types 1`] = ` | ||
Object { | ||
"name": "signature", | ||
"raw": "{| apple: string, banana: string, ...MyType |}", | ||
"signature": Object { | ||
"properties": Array [ | ||
Object { | ||
"key": "apple", | ||
"value": Object { | ||
"name": "string", | ||
"required": true, | ||
}, | ||
}, | ||
Object { | ||
"key": "banana", | ||
"value": Object { | ||
"name": "string", | ||
"required": true, | ||
}, | ||
}, | ||
Object { | ||
"key": "a", | ||
"value": Object { | ||
"name": "string", | ||
"required": true, | ||
}, | ||
}, | ||
Object { | ||
"key": "b", | ||
"value": Object { | ||
"name": "notImported", | ||
"nullable": true, | ||
"required": true, | ||
}, | ||
}, | ||
], | ||
}, | ||
"type": "object", | ||
} | ||
`; | ||
|
||
exports[`getFlowType handles nested ObjectTypeSpreadProperty 1`] = ` | ||
Object { | ||
"name": "signature", | ||
"raw": "{| apple: string, banana: string, ...BreakfastFruits |}", | ||
"signature": Object { | ||
"properties": Array [ | ||
Object { | ||
"key": "apple", | ||
"value": Object { | ||
"name": "string", | ||
"required": true, | ||
}, | ||
}, | ||
Object { | ||
"key": "banana", | ||
"value": Object { | ||
"name": "string", | ||
"required": true, | ||
}, | ||
}, | ||
Object { | ||
"key": "mango", | ||
"value": Object { | ||
"name": "string", | ||
"required": true, | ||
}, | ||
}, | ||
Object { | ||
"key": "orange", | ||
"value": Object { | ||
"name": "string", | ||
"required": true, | ||
}, | ||
}, | ||
Object { | ||
"key": "lemon", | ||
"value": Object { | ||
"name": "string", | ||
"required": true, | ||
}, | ||
}, | ||
], | ||
}, | ||
"type": "object", | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters