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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve tsconfig #180

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion packages/core/src/prompts/confirm.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cursor } from 'sisteransi';
import Prompt, { PromptOptions } from './prompt';
import Prompt, { type PromptOptions } from './prompt';

interface ConfirmOptions extends PromptOptions<ConfirmPrompt> {
active: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/prompts/group-multiselect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Prompt, { PromptOptions } from './prompt';
import Prompt, { type PromptOptions } from './prompt';

interface GroupMultiSelectOptions<T extends { value: any }>
extends PromptOptions<GroupMultiSelectPrompt<T>> {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/prompts/multi-select.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Prompt, { PromptOptions } from './prompt';
import Prompt, { type PromptOptions } from './prompt';

interface MultiSelectOptions<T extends { value: any }> extends PromptOptions<MultiSelectPrompt<T>> {
options: T[];
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/prompts/password.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import color from 'picocolors';
import Prompt, { PromptOptions } from './prompt';
import Prompt, { type PromptOptions } from './prompt';

interface PasswordOptions extends PromptOptions<PasswordPrompt> {
mask?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/prompts/select-key.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Prompt, { PromptOptions } from './prompt';
import Prompt, { type PromptOptions } from './prompt';

interface SelectKeyOptions<T extends { value: any }> extends PromptOptions<SelectKeyPrompt<T>> {
options: T[];
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/prompts/select.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Prompt, { PromptOptions } from './prompt';
import Prompt, { type PromptOptions } from './prompt';

interface SelectOptions<T extends { value: any }> extends PromptOptions<SelectPrompt<T>> {
options: T[];
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/prompts/text.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import color from 'picocolors';
import Prompt, { PromptOptions } from './prompt';
import Prompt, { type PromptOptions } from './prompt';

export interface TextOptions extends PromptOptions<TextPrompt> {
placeholder?: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/prompts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
PasswordPrompt,
SelectKeyPrompt,
SelectPrompt,
State,
TextPrompt
TextPrompt,
type State
} from '@clack/core';
import isUnicodeSupported from 'is-unicode-supported';
import color from 'picocolors';
Expand Down
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
"noEmit": true,
"module": "ESNext",
"target": "ESNext",
"moduleResolution": "node",
"moduleResolution": "Bundler",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bundler is good for apps, but node16 is better for libraries. that's because bundler is more permissive about things like file endings, which is good for consuming a variety of libraries, but node16 is stricter, which is better when your library may be consumed by apps with a variety of different settings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but in the end it will be changed by unbuild. Do you think it's still worth it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with unbuild or why they would do that. Ideally it shouldn't or there should be an option to configure it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unbuild imports all the code and puts it in a single file, then minimizes it, so there is no import after it has been compiled. It means that the moduleResolution won't have any impact after all.

"moduleDetection": "force",
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
"lib": ["ES2022"],
"paths": {
"@clack/core": ["./packages/core/src"]
}
Expand Down
Loading