ts-add-js-extension
Version:
Add .js extension to each relative ESM import and export statement in JavaScript file
116 lines (115 loc) • 3.38 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.6";
};
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 parseBoolean: <Keyword extends string>(keyword: Keyword) => () => {
readonly exists: false;
readonly type?: never;
readonly value?: never;
} | {
readonly type: Keyword;
readonly exists: true;
readonly value: boolean;
};
readonly parseShowProgress: () => {
readonly exists: false;
readonly type?: never;
readonly value?: never;
} | {
readonly type: "showprogress";
readonly exists: true;
readonly value: boolean;
};
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.6";
};
readonly asHelp: () => ReturnType<TokenParser["parseHelp"]>;
readonly asOperation: () => {
readonly dir: string;
/**
* @deprecated
* Will be removed in version 2.0
* */
readonly include: string[] | undefined;
/**
* @deprecated
* Will be removed in version 2.0
* `showChanges` is deprecated in favor of `showProgress`
* */
readonly showChanges: boolean | undefined;
readonly showProgress: boolean | undefined;
};
}
type TrueConfig = ReturnType<ParseArgs['asOperation']>;
type PartialConfig = Partial<Omit<TrueConfig, 'dir'>> & Pick<TrueConfig, 'dir'>;
export type { TrueConfig, PartialConfig };
export default ParseArgs;