temp fix: suppress TS1192 for CJS-type npm packages on TS 6.0 / Deno v2.8.3#3857
Open
SisyphusZheng wants to merge 1 commit into
Open
temp fix: suppress TS1192 for CJS-type npm packages on TS 6.0 / Deno v2.8.3#3857SisyphusZheng wants to merge 1 commit into
SisyphusZheng wants to merge 1 commit into
Conversation
Deno v2.8.3 upgraded TypeScript from 5.9.2 to 6.0.3. TS 6.0 changed \export =\ in ESM context from a warning (TS1203) to a hard error (TS1192): \Module has no default export\. \@prefresh/vite\ and \@tailwindcss/postcss\ both publish \.d.ts\ files using \export =\ (CJS syntax), but their \exports.import\ condition declares ESM support. With Deno's default \moduleResolution: NodeNext\, TS 6.0 sees \exports.import\ and treats the \.d.ts\ as ESM — where \export =\ is now an error. This is reproducible against stock \ sc --moduleResolution NodeNext\ and is not a Deno bug. The runtime import works correctly (Deno handles CJS→ESM interop). The upstream packages' type declarations and package.json metadata are self-contradictory. Temporary fix: \@ts-ignore TS1192\ with a comment explaining the situation. Upstream issues should be filed for both packages to resolve the \export =\ vs \exports.import\ inconsistency.
Contributor
|
It's a regression. Not a Fresh side problem. |
Contributor
Author
I understand, but this has impacted the current CI v2. This is only a temporary hotfix, and I’ve also raised an issue on the Deno side. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Deno v2.8.3 upgraded TypeScript from 5.9.2 to 6.0.3, which changed
export =in ESM context from a warning (TS1203) to a hard error (TS1192). This causesdeno checkto fail on any imported npm package whose.d.tsusesexport =CJS syntax but whosepackage.jsondeclares ESM support viaexports.import.Two dependencies in this repo are affected:
import prefresh from "@prefresh/vite"packages/plugin-vite/src/mod.ts:9@prefresh/vite@2.4.11import twPostcss from "@tailwindcss/postcss"packages/plugin-tailwindcss/src/mod.ts:2@tailwindcss/postcss@4.1.16Root Cause Analysis
This is reproducible against stock
tsc --moduleResolution NodeNext— not a Deno-specific bug. The upstream packages have a self-contradictory setup:exports.importsays ESM, but type declarations use CJS syntax (export =).The runtime import works correctly — Deno handles CJS→ESM interop at runtime. Only the type checker disagrees.
Fix
Add
@ts-ignore TS1192with an explanatory comment on the two affected imports.Follow-up
@prefresh/vite(maintained by @marvinhagemeister, also a Fresh maintainer) to resolveexport =vsexports.importinconsistency@tailwindcss/postcssfor the same type declaration issue