Closed micalevisk closed 5 months ago
You're trying to use a type as a value.
User
is an interface not a class.
The correct code would be
import { cast, MinLength, ReflectionClass } from '@deepkit/type';
interface User {
username: string & MinLength<3>;
birthDate?: Date;
}
const user = cast<User>({
username: 'Peter',
birthDate: '2010-10-10T00:00:00Z'
});
console.log(user);
const reflection = ReflectionClass.from<User>();
console.log(reflection.getProperty('username').type);
ty
After following the steps at https://deepkit.io/documentation/runtime-types/getting-started (everything before the Type compiler section) I'm seeing this error:
The repro: https://gitlab.com/micalevisk/deepkit-runtime-type-starter-issue
Steps to reproduce:
running
node_modules/.bin/deepkit-type-install
didn't fix it neither.