Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typed config after npx ts-jest config:init #2735

Closed
wtho opened this issue Jul 7, 2021 · 0 comments 路 Fixed by #2742
Closed

Typed config after npx ts-jest config:init #2735

wtho opened this issue Jul 7, 2021 · 0 comments 路 Fixed by #2742
Labels
馃殌 Feature Request new suggested feature

Comments

@wtho
Copy link
Contributor

wtho commented Jul 7, 2021

馃殌 Feature Proposal

The initialized config should be typed. Everyone using this preset likes types.

Motivation

Everybody loves code completion

Example

Currently, after running npx ts-jest config:init, the following config is created:
jest.config.js:

module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
};

What I really want is either (stolen right from the jest docs)
jest.config.js:

/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
};

Or alternatively (everyone using ts-jest also uses typescript, but this requires ts-node to be installed)
jest.config.ts:

import type { Config } from '@jest/types';

const config: Config = {
  preset: 'ts-jest',
  testEnvironment: 'node',
};

default export config;

I guess the comment type import is the way to go.

@wtho wtho added the 馃殌 Feature Request new suggested feature label Jul 7, 2021
@ahnpnl ahnpnl linked a pull request Jul 12, 2021 that will close this issue
2 tasks
@ahnpnl ahnpnl closed this as completed Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃殌 Feature Request new suggested feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants