TypeStrong / TypeStrong/ts-loader

Bundle failure when export default "satisfies" any generic type, in Typescript 4.9.1-beta

Open
#1,511 10 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.5k
Forks
439
Avg merge
17h 17m
Merged PRs (30d)
2

Description

Expected Behaviour

Output file is bundled correctly.

Actual Behaviour

The output file index.js only contains the 2 lines of the compiled entry file without bundling anything.

(()=>{"use strict"
simpleWrap(mainComponent,void 0)})()
Steps to Reproduce the Problem

Import anything and use it in export default,
Then add "satisfies Readonly" or satisfies any other generic type at the end

import mainComponent from '@/mainComponent';
import simpleWrap from '@/simpleWrap';

export default simpleWrap(
  mainComponent,
  undefined,
) satisfies Readonly<unknown>;

This only happens when export default satisfies a generic type, "satisfies unknown" or "satisfies () => void" work correctly.

Dependencies:

    "ts-loader": "^9.3.1",
    "typescript": "^4.9.1-beta",
    "webpack": "^5.74.0",
    "webpack-bundle-analyzer": "^4.6.1",
    "webpack-cli": "^4.10.0",
    "webpack-dev-server": "^4.10.1",
Location of a Minimal Repository that Demonstrates the Issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the listed ts-loader, TypeScript 4.9.1-beta, and webpack dependencies using the export-default example. Compare the generated index.js with the expected bundle and test the generic satisfies case against the working satisfies unknown case. Done means imported modules are bundled correctly for the generic satisfies expression.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.