TypeStrong / TypeStrong/ts-loader

transpileOnly : true will make const enum not work

Open
#1,491 1 comment 0 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

when I use transpileOnly : true , const enum will not work。 I think it is reasonable, but it would be good if had a description in the document

Actual Behaviour
//  test.d.ts
declare namespace Test {
  export const enum Hello {
    Hello = 1
  }
}
// index.ts

console.log(Test.Hello.Hello)

image

Steps to Reproduce the Problem
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 locating the ts-loader documentation for transpileOnly and reviewing how it describes TypeScript features that require type checking. Document that const enum usage does not work as expected with transpileOnly enabled, using the provided test.d.ts and index.ts example as the reference; done when users can find and understand this limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
build-system, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.