Skip to content

Make tsgo required when importing from .ts files #978

@milkyskies

Description

@milkyskies

Currently tsgo is optional - when missing, the compiler silently falls back to unknown types for all TS imports. This leads to confusing downstream errors (unknown bindings, wrong type-only imports, missing type info in hover).

Proposal

When a .fl file imports from a .ts file and tsgo is not installed, emit a hard error:

error: tsgo is required to resolve TypeScript imports
  --> src/components/board.fl:8:1
   |
8  | import trusted { useJiraStore } from "../../stores/jira-store"
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: install with: npm i -g @typescript/native-preview

npm imports (from node_modules) could remain soft-warning since they have .d.ts files that can be parsed without tsgo.

Why not bundle tsgo

  • Version coupling (tsgo is actively developed, would go stale)
  • Binary size increase
  • tsgo is a TS team project, not ours to redistribute

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