Skip to content

README stylesheet side-effect imports fail tsc on TypeScript 6 (TS2882) #387

Description

@woksin

The README ("Minimal setup") and the package README import the stylesheets from TypeScript as side-effect imports:

import 'reflect-metadata';
import '@cratis/components/tokens';
import '@cratis/components/styles';
import '@cratis/components/theme'; // optional baseline appearance

With TypeScript 6.0.3, which checks side-effect imports by default (noUncheckedSideEffectImports), tsc fails on these three lines when they are in a .tsx file:

error TS2882: Cannot find module or type declarations for side-effect import of '@cratis/components/tokens'.
error TS2882: Cannot find module or type declarations for side-effect import of '@cratis/components/styles'.
error TS2882: Cannot find module or type declarations for side-effect import of '@cratis/components/theme'.

Reproduced with @cratis/components 4.22.0, @cratis/arc.react 22.39.1, TypeScript 6.0.3 (@typescript/typescript6), and the compiler options of the cratis template (moduleResolution: "bundler", strict: true, noEmit: true, jsx: "react-jsx", no ambient CSS module declarations).

The cratis template avoids it by importing the stylesheets from its CSS entry (@import '@cratis/components/tokens'; and so on).

Expected: the documented setup type-checks on TypeScript 6. Options: show the CSS @import form, or document the ambient declaration (for example vite/client types or a declare module for the stylesheet subpaths) that a TypeScript project needs, or ship type declarations for the stylesheet export subpaths.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions