facebook / facebook/flow

Union type of exact object types doesn't add refinement based on property only in one of the choices

Aperta
#4,772 6 commenti 12 reazioni 0 assegnatari Vedi su GitHub
Typing: unions/intersections
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

If this is a bug, please try reproducing using https://flow.org/try/.

Reproducible: https://flow.org/try/#0PTAEAEDMBsHsHcBQBLAtgB1gJwC6gEoCmAhgMZ6RayqgDkWJ5tA3IqbAHYDOepAHqAC8oABQA6CcQ4BPAFxTpASiEA+OsVqJEOaekKgAClXRchoAN4AfRKFAdiqQrNA8syDgHMANDdCloxFxcAHIOTqAA-K7u3oiWAL6glhbWtvaOXM4AglhYxNIAPNGeKj62-oEhYc5ROG6ePgmsbJw8oB6EOADCAUGhGWYi6YSZoDl5hcUeKorZuflFdTFqgmrmvgw4AK5YHHZhXGKoxOhDYar7joqs8c3s3HgAkveD6MajRrAmyquivkXoKR+XpVRyCcz8ERvL6HCp9MJedqdHqVfojKHvMTDSKgADa0JMWLCAF1QM4CYdhlxFIp4sAVIhrlogA

// @flow
import React from 'react';
const cx = (...any:any) => 'a'

type Props = {|
name: string,
className: ?string,
|} | {|
names: Array,
className: ?string,
|};

const getClassNames = (names: Array): Array => {
return names.map(name => name);
};

const Icon = (props: Props) => (

);

Error:

```

18:
^ property `names`. Property not found in
18:
^ object type

```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.