-
-
Notifications
You must be signed in to change notification settings - Fork 193
Open
Labels
bugSomething isn't workingSomething isn't working
Description
📝 Summary
Write a short summary of the bug in here.
- Typia Version: 9.7.2
- Expected behavior: Concise checks
- Actual behavior: Redundant checks
Unions result in redundant checks, effectively if(type === 'A') { if (type === 'A' && ...) { ... } }
⏯ Playground Link
💻 Code occuring the bug
import typia, { tags } from "typia";
type Orange = { name: 'Orange', color: 'orange' };
type Apple = { name: 'Apple', color: 'red' | 'green' };
type Banana = { name: 'Banana', color: 'yellow' };
type Fruit = Orange | Apple | Banana;
declare const fruit: Fruit;
typia.is<Fruit>(fruit);generates:
...
const _io2 = (input) => "Banana" === input.name && "yellow" === input.color;
const _iu0 = (input) =>
(() => {
if ("Banana" === input.name) return _io2(input);
...Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working