You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Importing @colors/colors will break types (This is extremely rare --- This is the first time I have ever seen this happen)
The following code will run perfectly fine, fully type-safe. However, as soon as you import @colors/colors, it will cause an error.
Even if you import @colors/colors in a separate file (e.g inside a nested folder), it will STILL break the types!
// import colors from '@colors/colors'; // Uncommenting this line will cause the error.
// // You can also move the line to a separate file -- it will STILL cause this error.
import { z } from 'zod';
export type UnionToIntersection<U> = (U extends U ? (u: U) => 0 : never) extends (i: infer I) => 0 ? Extract<I, U> : never;
export type ArrayToIntersection<T extends readonly unknown[]> = UnionToIntersection<T[number]>;
export function arrayToIntersection<T extends readonly any[]>(arr: T): UnionToIntersection<T[number]> {
return '' as any;
}
const tempTrash = arrayToIntersection([
z.object({
foo: z.object({
one: z.string(),
}),
}),
z.object({
foo: z.object({
two: z.string(),
}),
}),
]);
type TempTrash = z.infer<typeof tempTrash>;
const something: TempTrash = { foo: { one: '', two: '' } };
The text was updated successfully, but these errors were encountered:
Lawlzer
added a commit
to Lawlzer/utils
that referenced
this issue
Dec 2, 2022
Importing @colors/colors will break types (This is extremely rare --- This is the first time I have ever seen this happen)
The following code will run perfectly fine, fully type-safe. However, as soon as you import @colors/colors, it will cause an error.
Even if you import @colors/colors in a separate file (e.g inside a nested folder), it will STILL break the types!
The text was updated successfully, but these errors were encountered: