-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add override for string version of function - fix default export error in Typescript 3.9
- Loading branch information
1 parent
34689d5
commit 6fee116
Showing
1 changed file
with
30 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,38 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
/** | ||
Sort packageJson. | ||
declare namespace sortPackageJsonExports { | ||
interface SortPackageJsonFn { | ||
/** | ||
* Sort packageJson object. | ||
* | ||
* @param packageJson - A packageJson | ||
* @param options | ||
* @returns Sorted packageJson object | ||
*/ | ||
<T extends Record<any, any>>(packageJson: T, options?: Options): T, | ||
|
||
/** | ||
* Sort packageJson string. | ||
* | ||
* @param packageJson - A packageJson string. | ||
* @param options | ||
* @returns Sorted packageJson string. | ||
*/ | ||
(packageJson: string, options?: Options): string, | ||
} | ||
|
||
@param packageJson - A packageJson object or string. | ||
@param options | ||
@returns Sorted packageJson object or string. | ||
*/ | ||
declare function sortPackageJsonCore<T extends Record<any, any>>(packageJson: T, options?: sortPackageJsonCore.Options): T; | ||
declare namespace sortPackageJsonCore { | ||
var sortPackageJson: <T extends Record<any, any>>(packageJson: T, options?: sortPackageJsonCore.Options) => T; | ||
// @ts-ignore | ||
var default: <T extends Record<any, any>>(packageJson: T, options?: sortPackageJsonCore.Options) => T; | ||
} | ||
declare namespace sortPackageJsonCore { | ||
type ComparatorFunction = (left: string, right: string) => number; | ||
|
||
interface Options { | ||
readonly sortOrder?: readonly string[] | ComparatorFunction; | ||
} | ||
/** | ||
Default sort order. | ||
*/ | ||
const sortOrder: readonly string[]; | ||
} | ||
export = sortPackageJsonCore; | ||
|
||
interface sortPackageJsonExports extends sortPackageJsonExports.SortPackageJsonFn { | ||
readonly default: sortPackageJsonExports.SortPackageJsonFn; | ||
readonly sortPackageJson: sortPackageJsonExports.SortPackageJsonFn; | ||
} | ||
|
||
declare const sortPackageJsonExports: sortPackageJsonExports; | ||
|
||
export = sortPackageJsonExports; |