Open sounisi5011 opened 1 year ago
https://github.com/zkochan/packages/blob/6da32f07fb3592675505b77724e8e4fd17afaa34/which-pm/index.d.ts#L1
https://github.com/zkochan/packages/blob/6da32f07fb3592675505b77724e8e4fd17afaa34/which-pm/index.d.ts#L4
In this type declaration, the return type is defined as Promise<whichpm.NPM | whichpm.YARN | whichpm.PNPM | whichpm.Other>.
Promise<whichpm.NPM | whichpm.YARN | whichpm.PNPM | whichpm.Other>
However, according to the actual code, this function could return null.
null
https://github.com/zkochan/packages/blob/6da32f07fb3592675505b77724e8e4fd17afaa34/which-pm/index.js#L19
Therefore, the correct return type is Promise<whichpm.NPM | whichpm.YARN | whichpm.PNPM | whichpm.Other | null>.
Promise<whichpm.NPM | whichpm.YARN | whichpm.PNPM | whichpm.Other | null>
This type declaration should add null to the type whichpm.Result.
whichpm.Result
- type Result = NPM | YARN | PNPM | Other + type Result = NPM | YARN | PNPM | Other | null
Or, should add null to the return type.
- declare function whichpm (pkgPath: string): Promise<whichpm.Result> + declare function whichpm (pkgPath: string): Promise<whichpm.Result | null>
https://github.com/zkochan/packages/blob/6da32f07fb3592675505b77724e8e4fd17afaa34/which-pm/index.d.ts#L1
https://github.com/zkochan/packages/blob/6da32f07fb3592675505b77724e8e4fd17afaa34/which-pm/index.d.ts#L4
In this type declaration, the return type is defined as
Promise<whichpm.NPM | whichpm.YARN | whichpm.PNPM | whichpm.Other>
.However, according to the actual code, this function could return
null
.https://github.com/zkochan/packages/blob/6da32f07fb3592675505b77724e8e4fd17afaa34/which-pm/index.js#L19
Therefore, the correct return type is
Promise<whichpm.NPM | whichpm.YARN | whichpm.PNPM | whichpm.Other | null>
.This type declaration should add
null
to the typewhichpm.Result
.Or, should add
null
to the return type.