ts-add-js-extension
Version:
Add .js extension to each relative ESM import and export statement in JavaScript file
88 lines (87 loc) • 2.54 kB
TypeScript
declare class TokenParser {
private readonly token;
constructor(token: Token);
readonly parseVersion: () => {
readonly exists: false;
readonly type?: never;
readonly value?: never;
} | {
readonly type: "version";
readonly exists: true;
readonly value: "1.6.5";
};
readonly parseHelp: () => {
readonly exists: false;
readonly type?: never;
readonly value?: never;
} | {
readonly type: "help";
readonly exists: true;
readonly value: string;
};
readonly parseDir: () => {
readonly exists: false;
readonly type?: never;
readonly value?: never;
} | {
readonly type: "dir";
readonly exists: true;
readonly value: string;
};
readonly parseInclude: () => {
readonly exists: false;
readonly type?: never;
readonly value?: never;
} | {
readonly type: "include";
readonly exists: true;
readonly value: string[];
};
readonly parseShowChanges: () => {
readonly exists: false;
readonly type?: never;
readonly value?: never;
} | {
readonly type: "showchanges";
readonly exists: true;
readonly value: boolean;
};
readonly processNonRecognisableToken: () => {
readonly type: "invalid";
readonly reason: `${string}=${string} token cannot be recognized`;
readonly token: Readonly<{
key: string;
value: string;
}>;
};
}
type Token = Readonly<{
key: string;
value: string;
}>;
declare class ParseArgs {
private readonly tokens;
private constructor();
static readonly create: (arg: string) => ParseArgs;
private static readonly checkPackageName;
private readonly tokenize;
readonly asVersion: () => {
readonly exists: false;
readonly type?: never;
readonly value?: never;
} | {
readonly type: "version";
readonly exists: true;
readonly value: "1.6.5";
};
readonly asHelp: () => ReturnType<TokenParser["parseHelp"]>;
readonly asOperation: () => {
readonly dir: string;
readonly include: string[] | undefined;
readonly showChanges: boolean | undefined;
};
}
type TrueConfig = ReturnType<ParseArgs['asOperation']>;
type PartialConfig = Partial<Omit<TrueConfig, 'dir'>> & Pick<TrueConfig, 'dir'>;
export type { TrueConfig, PartialConfig };
export default ParseArgs;