Skip to content

Tests compare TSRX error codes as literal strings, which change in the next @tsrx/core #1337

Closed

Description

@leonidaz

Important

Two parts, with different timing.

Summary

@tsrx/core is giving every error a standard code (tsrx-org/tsrx#843): TypeScript's own code for a mistake TypeScript also reports, such as TS1029, and a TSRX code for TSRX's own errors, such as TSRX1001. Today's string codes, like tsrx-jsx-spread-child, become TSRX codes. The constant names in DIAGNOSTIC_CODES stay the same; only their values change.

Four places in Octane's tests compare the codes as literal strings, and those will fail after the upgrade:

// Today: fails once the code becomes a TSRX code
const SPREAD_CHILD = 'tsrx-jsx-spread-child';
// Instead: passes with today's @tsrx/core and the next
import { DIAGNOSTIC_CODES } from '@tsrx/core';

const SPREAD_CHILD = DIAGNOSTIC_CODES.JSX_SPREAD_CHILD;

The four, at 211144a0:

Place Literal Constant
jsx-spread-child.test.ts#L6 'tsrx-jsx-spread-child' DIAGNOSTIC_CODES.JSX_SPREAD_CHILD
style-standalone-placement.test.ts#L14 'tsrx-style-standalone-outside-template' DIAGNOSTIC_CODES.STYLE_STANDALONE_OUTSIDE_TEMPLATE
style-standalone-placement.test.ts#L65 'tsrx-style-standalone-at-module-scope' DIAGNOSTIC_CODES.STYLE_STANDALONE_AT_MODULE_SCOPE
style-global-forms.test.ts#L106 'tsrx-css-global-placement' DIAGNOSTIC_CODES.CSS_GLOBAL_PLACEMENT

Errors that have no code today, such as the return/break/continue template errors and TypeScript-style mistakes, get one in that release.

On Node, Octane parses with @tsrx/oxc first, whose errors carry no code today. @tsrx/oxc has its own issue to report the same codes as @tsrx/core (tsrx-org/oxc#117); until it does, a test that checks a code on Node sees @tsrx/oxc's error.

References

Activity

  1. leonidaz commented on Sep 27, 2026

    @leonidaz
    CollaboratorAuthor

    The codes are final (tsrx-org/tsrx#888, merged); the table in #1357 gives each constant's new value. That issue also covers what else changes for Octane on the upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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