Skip to content

Frontend rejects decorators with SC0001: Decorators are not valid here. #238

Description

@Caleul

Description

scriptc rejects decorator syntax with SC0001: Decorators are not valid here. instead of compiling it. This makes it impossible to build any codebase that relies on decorators — including NestJS apps, which use them pervasively for dependency injection, controllers, providers, and parameter injection.

In the case below, a standard NestJS constructor parameter decorator (@InjectPinoLogger from nestjs-pino) is rejected, even though it is valid TypeScript and compiles fine with tsc.

Minimal Demo

import { Injectable } from "@nestjs/common";
import { InjectPinoLogger, PinoLogger } from "nestjs-pino";

@Injectable()
export class FileValidationService {
  constructor(
    @InjectPinoLogger(FileValidationService.name)
    private readonly logger: PinoLogger,
  ) {}
}

Output

src/server/shared/modules/filesystem/file-validation.service.ts:31:5 - error SC0001: Decorators are not valid here.

  30 |   constructor(
  31 |     @InjectPinoLogger(FileValidationService.name)
     |     ^
  32 |     private readonly logger: PinoLogger,

Expected

Decorators should be supported (class, method, property, accessor, and parameter decorators), compiling to their equivalent runtime form and preserving metadata — matching TS experimentalDecorators + emitDecoratorMetadata semantics that frameworks like NestJS depend on.

If full decorator support is out of scope, the limitation should be clearly documented, since SC0001 currently blocks entire categories of TypeScript projects.

Environment

  • @scriptc/compiler version: 0.0.35
  • OS: MacOS

Notes

This same file compiles without errors under tsc with experimentalDecorators and emitDecoratorMetadata enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions