我有一個正在被解析的JSON對象,並且正在編寫輸出的測試,並且我無法在運行時檢查特定對象是否符合流類型。你可以在運行時檢查對象是否符合Flow類型?
const object = {/**/}
type SomeType = {
foo: string,
bar: bool,
baz: Object,
}
describe('object',() => {
describe('.subfield',() => {
it('conforms to SomeType',() => {
// Here I want to write an 'expect'
// that checks if object.subfield
// conforms to the SomeType flow type?
})
});
});
有什麼辦法可以實現嗎?