swc-project / swc-project/swc-node

class-validator not work

Open
#512 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2k
Forks
95
Avg merge
14d 11h
Merged PRs (30d)
1

Description

export class CreateCategoryDto {
    @IsNotEmpty({ groups: ['create'] })
    @IsOptional({ groups: ['update'] })
    name!: string;
}

It always throw exception that name not exist

config

const { register } = require('@swc-node/register/register');

register({
    extends: tsconfig,
    target: 99,
    module: 1,
    experimentalDecorators: true,
    emitDecoratorMetadata: true,
    esModuleInterop: true,
    jsx: false,
});

ts-node worked fine

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the CreateCategoryDto validation case with @swc-node/register/register and compare it with the stated ts-node behavior. Check how the shown decorator and register configuration are handled; the issue is done when the create and update validation groups behave as intended or the missing reproduction details are identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.