microsoft / microsoft/TypeScript
random emit declaration
Open
@weswigham is already working on this.
Since Aug 17, 2020.
Bug
Domain: Declaration Emit
Rescheduled
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
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:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.