babel / babel/babel

@babel/register: add typescript to default extensions -> .ts,.tsx

Open
#11,833 1 comment 3 reactions 0 assignees View on GitHub
pkg: register
Dominant language
TypeScript
Stars
44k
Forks
6k
Avg merge
5d 15h
Merged PRs (30d)
23

Description

## Feature Request

- [x] I would like to work on this feature!

**Is your feature request related to a problem?**

Currently when one uses typescript as language and type checking and babel for transpilation and with that tooling usage is needed, for instance with mocha or uvu etc, there is no way to use `mocha --register @babel/register my-tests.spec.ts`

**Describe the solution you'd like**

It would be nice to add typescript to default set off extensions.

With that set, we would need to add a check if `preset-typescript` is present and if it's not, we should error out with appropriate information for user - `"Hey looks like you wanna transpile typescript but your config is missing 'preset-typescript' preset"`.

**Describe alternatives you've considered**.

Currently we need to use `ts-node` which feels quite redundant especially when all transpilation and tooling is powered by babel.

Contributor guide

Open the contributing guide

Research direction

Start at the @babel/register entry point and inspect how its default extensions are defined. Check how preset-typescript configuration is detected, then verify that .ts and .tsx registration works and that a missing preset produces the requested guidance; the issue does not name a file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Feature
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.