Skip to content

Generated components.d.ts has invalid syntax in declare global for TSX: invalid identifier with colon #894

@Calvinvv

Description

@Calvinvv

Describe the bug

Expected Behavior
The generated components.d.ts should have valid TypeScript syntax in the declare global block for TSX support, e.g., using proper identifier names without colons or invalid characters.
Actual Behavior
The generated code in declare global uses invalid identifiers like const 'ICodex:checklist': typeof ..., which contains a colon (:) and is wrapped in quotes, making it an invalid variable name. This causes TypeScript syntax errors (e.g., "应为变量声明" or "Expected ';'"). Even manually adding semicolons does not fix it, as the core issue is the invalid identifier.

Image

Reproduction

i-codex:checklist</i-codex:checklist> // For TSX support declare global { const 'ICodex:checklist': typeof import('~icons/codex/checklist')['default'] const 'ICodex:directionDownRight': typeof import('~icons/codex/direction-down-right')['default'] }

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 7840HS w/ Radeon 780M Graphics
    Memory: 2.46 GB / 13.72 GB
  Binaries:
    Node: 20.19.0 - D:\nvm\nodejs\node.EXE
    npm: 11.1.0 - D:\nvm\nodejs\npm.CMD
    pnpm: 10.20.0 - C:\Users\Calvin\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Chrome: 142.0.7444.59
    Edge: Chromium (139.0.3405.102)
    Internet Explorer: 11.0.22621.3527

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

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