source.decorators

  • Type:
type Decorators = {
  version?: 'legacy' | '2022-03';
};

Used to configure the decorators syntax.

decorators.version

  • Type: 'legacy' | '2022-03'
  • Default: '2022-03'

Specify the decorator syntax version to be used.

2022-03

2022-03 corresponds to the Stage 3 decorator proposal, equivalent to the decorator syntax supported by TypeScript 5.0 by default.

rsbuild.config.ts
export default {
  source: {
    decorators: {
      version: '2022-03',
    },
  },
};

Reference documentation:

legacy

Equivalent to TypeScript's experimentalDecorators: true.

rsbuild.config.ts
export default {
  source: {
    decorators: {
      version: 'legacy',
    },
  },
};

Reference documentation: