Skip to content

The ./styles subpath export has no types condition — side-effect import errors under TypeScript 6 #357

Description

@BSalaeddin

Problem

packages/next/package.json (and the sibling framework packages that ship the same pattern) exports the stylesheet as a bare string:

"./styles": "./dist/tailwind-prefixed.css"

TypeScript 6.0 started type-checking side-effect imports, so a consumer on TS 6.x doing the documented

import '@upupjs/next/styles'

now fails to resolve declarations for the subpath (no types condition, no declaration file), forcing every TS 6 consumer to hand-write an ambient declare module '@upupjs/next/styles' shim.

Hit in production use: DevinoSolutions/GetItDone's TS 6.0.3 upgrade needed a local upup-styles.d.ts workaround for exactly this (verified against @upupjs/next / @upupjs/core 3.1.0, 2026-08-14).

Fix options

  1. allowArbitraryExtensions-style declaration (TS-official mechanism): ship dist/tailwind-prefixed.d.css.ts next to the CSS and add a types condition:
    "./styles": {
        "types": "./dist/tailwind-prefixed.d.css.ts",
        "default": "./dist/tailwind-prefixed.css"
    }
  2. Or a plain empty ambient declaration (declare module '@upupjs/next/styles';) shipped in dist and referenced by a types condition.

Either removes the consumer-side shim with no runtime change. Worth sweeping every framework package (react, vue, svelte, vanilla, angular, preact, next) that exposes a CSS subpath the same way.

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