Consider the following code:
import {getType,Type} from "tst-reflect";
class A
{
s?: string | undefined;
}
console.log(getType<number|string>().isUnion());
console.log(getType<A>().getProperties().find(p => p.name == "s")!.type.isUnion());
The first check works fine and returns true.
In the second check, the type of s is clearly a union, but it returns false.
The same thing happens if I try to extract the types — the first statement correctly returns the two types, while the second one sometimes returns an empty array and sometimes return undefined.
I'm using Vite with HMR (btw the hot reloading doesn't trigger when the transformed input changes, it may or may not be a problem on your side of things).
Consider the following code:
The first check works fine and returns
true.In the second check, the type of
sis clearly a union, but it returnsfalse.The same thing happens if I try to extract the types — the first statement correctly returns the two types, while the second one sometimes returns an empty array and sometimes return undefined.
I'm using Vite with HMR (btw the hot reloading doesn't trigger when the transformed input changes, it may or may not be a problem on your side of things).