- vscode쪽에서 강제로 내는 에러
- .vscode/settings.json 에서
"js/ts.implicitProjectConfig.experimentalDecorators": true
필요
This commit is contained in:
2023-08-04 17:33:16 +00:00
parent a39543e718
commit a261b45e5d
3 changed files with 14 additions and 15 deletions
+1
View File
@@ -0,0 +1 @@
20
-11
View File
@@ -1,21 +1,10 @@
import { import {
validate,
validateOrReject,
Contains,
IsInt, IsInt,
Length,
IsEmail,
IsFQDN,
IsDate,
Min,
Max,
IsString, IsString,
} from 'class-validator'; } from 'class-validator';
export class BasicQueryDTO { export class BasicQueryDTO {
@IsInt() @IsInt()
generalID!: number; generalID!: number;
@IsString()
command!: string; command!: string;
} }
+13 -4
View File
@@ -1,11 +1,20 @@
//import 'reflect-metadata'; import 'reflect-metadata';
//import { BasicQueryDTO } from './api'; import { BasicQueryDTO } from './api/index.js';
import { validate } from 'class-validator';
export function test(){ export async function test(){
console.log("Hello World!"); console.log("Hello World!");
const dto = new BasicQueryDTO();
dto.command = 'None';
dto.generalID = 1.1;
const result = await validate(dto);
console.log(result);
//must be integer가 나타나야함
} }
test(); await test();
export default {}; export default {};