-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesFix AvailableA PR has been opened for this issueA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
TypeScript Version: 3.7.x-dev.201xxxxx
Search Terms:
Code
import { npa, getSemverFromNpaResult} from '../index';
import { stripScope } from './stripScope';
import { IParsePackageName, IResult } from './types';
/**
* @deprecated
*/
export function parseArgvPkgName(input: string)
{
const result = npa(input)
if (result)
{
return {
input,
namespace: result.scope,
name: stripScope(result.name),
version: getSemverFromNpaResult(result),
result,
}
}
}
export function parsePackageName(packageName: string): IParsePackageName
{
const result = npa(packageName)
const subname = stripScope(result.name);
let semver = getSemverFromNpaResult(result);
if (!semver?.length)
{
semver = void 0;
}
return {
type: result.type,
name: result.name,
scope: result.scope,
subname,
semver,
result,
}
}
Expected behavior:
emit .d.ts always same
Actual behavior:
random emit one of code
/// <reference types="npm-package-arg" />
import { IParsePackageName } from './types';
/**
* @deprecated
*/
export declare function parseArgvPkgName(input: string): {
input: string;
namespace: string;
name: string;
version: string;
result: import("npm-package-arg").FileResult | import("npm-package-arg").HostedGitResult | import("npm-package-arg").URLResult | import("npm-package-arg").AliasResult | import("npm-package-arg").RegistryResult;
};
export declare function parsePackageName(packageName: string): IParsePackageName;
or
import { IParsePackageName, IResult } from './types';
/**
* @deprecated
*/
export declare function parseArgvPkgName(input: string): {
input: string;
namespace: string;
name: string;
version: string;
result: IResult;
};
export declare function parsePackageName(packageName: string): IParsePackageName;
Playground Link:
Related Issues:
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesFix AvailableA PR has been opened for this issueA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone