ajv-validator / ajv-validator/ajv
Enum type allows no overlap with typescript type
Aperta
enhancement
typescript
- Lingua principale
- TypeScript
- Stelle
- 14.8k
- Fork
- 1k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**What version of Ajv are you using? Does the issue happen if you use the latest version?**
8.19.2
IMO this is not fine:
```javascript
import Ajv2020 from 'ajv/dist/2020';
type AOrBType = 'a' | 'b';
const aOrBSchema: JSONSchemaType = {
type: 'string',
enum: ['FOO'],
};
```
The validator never produces a value that is truly `AOrBType`. However, there's no error with this definition. I think there should be.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.