Fix all internal JSDoc comments

If these are regular comments, then they won't appear in our d.ts files.
But, now we are relying on an external d.ts bundler to produce our final
merged, so they need to be present in the "input" d.ts files, meaning
they have to be JSDoc comments.

These comments only work today because all of our builds load their TS
files from scratch, so they see the actual source files and their
non-JSDoc comments.

The comments also need to be attached to a declaration, not floating,
otherwise they won't be used by api-extractor, so move them if needed.
This commit is contained in:
Jake Bailey
2022-09-07 14:04:47 -07:00
parent 231fa27f89
commit d12116d8da
93 changed files with 2839 additions and 2105 deletions

View File

@@ -100,9 +100,10 @@ export function nonRelativeModuleNameForTypingCache(moduleName: string) {
return nodeCoreModules.has(moduleName) ? "node" : moduleName;
}
/** @internal */
/**
* A map of loose file names to library names that we are confident require typings
*
* @internal
*/
export type SafeList = ReadonlyESMap<string, string>;
@@ -121,7 +122,6 @@ export function loadTypesMap(host: TypingResolutionHost, typesMapPath: Path): Sa
return undefined;
}
/** @internal */
/**
* @param host is the object providing I/O related operations.
* @param fileNames are the file names that belong to the same project
@@ -130,6 +130,8 @@ export function loadTypesMap(host: TypingResolutionHost, typesMapPath: Path): Sa
* @param packageNameToTypingLocation is the map of package names to their cached typing locations and installed versions
* @param typeAcquisition is used to customize the typing acquisition process
* @param compilerOptions are used as a source for typing inference
*
* @internal
*/
export function discoverTypings(
host: TypingResolutionHost,
@@ -371,9 +373,10 @@ export interface ScopedPackageNameValidationResult {
/** @internal */
export type PackageNameValidationResult = NameValidationResult | ScopedPackageNameValidationResult;
/** @internal */
/**
* Validates package name using rules defined at https://docs.npmjs.com/files/package.json
*
* @internal
*/
export function validatePackageName(packageName: string): PackageNameValidationResult {
return validatePackageNameWorker(packageName, /*supportScopedPackage*/ true);

View File

@@ -7,22 +7,22 @@ export type EventTypesRegistry = "event::typesRegistry";
export type EventBeginInstallTypes = "event::beginInstallTypes";
export type EventEndInstallTypes = "event::endInstallTypes";
export type EventInitializationFailed = "event::initializationFailed";
/* @internal */
/** @internal */
export const ActionSet: ActionSet = "action::set";
/* @internal */
/** @internal */
export const ActionInvalidate: ActionInvalidate = "action::invalidate";
/* @internal */
/** @internal */
export const ActionPackageInstalled: ActionPackageInstalled = "action::packageInstalled";
/* @internal */
/** @internal */
export const EventTypesRegistry: EventTypesRegistry = "event::typesRegistry";
/* @internal */
/** @internal */
export const EventBeginInstallTypes: EventBeginInstallTypes = "event::beginInstallTypes";
/* @internal */
/** @internal */
export const EventEndInstallTypes: EventEndInstallTypes = "event::endInstallTypes";
/* @internal */
/** @internal */
export const EventInitializationFailed: EventInitializationFailed = "event::initializationFailed";
/* @internal */
/** @internal */
export namespace Arguments {
export const GlobalCacheLocation = "--globalTypingsCacheLocation";
export const LogFile = "--logFile";
@@ -41,12 +41,12 @@ export namespace Arguments {
export const ValidateDefaultNpmLocation = "--validateDefaultNpmLocation";
}
/* @internal */
/** @internal */
export function hasArgument(argumentName: string) {
return sys.args.indexOf(argumentName) >= 0;
}
/* @internal */
/** @internal */
export function findArgument(argumentName: string): string | undefined {
const index = sys.args.indexOf(argumentName);
return index >= 0 && index < sys.args.length - 1
@@ -54,7 +54,7 @@ export function findArgument(argumentName: string): string | undefined {
: undefined;
}
/* @internal */
/** @internal */
export function nowString() {
// E.g. "12:34:56.789"
const d = new Date();

View File

@@ -15,7 +15,7 @@ export interface TypingInstallerRequestWithProjectName {
readonly projectName: string;
}
/* @internal */
/** @internal */
export type TypingInstallerRequestUnion = DiscoverTypings | CloseProject | TypesRegistryRequest | InstallPackageRequest;
export interface DiscoverTypings extends TypingInstallerRequestWithProjectName {
@@ -44,7 +44,7 @@ export interface InstallPackageRequest extends TypingInstallerRequestWithProject
readonly projectRootPath: Path;
}
/* @internal */
/** @internal */
export interface TypesRegistryResponse extends TypingInstallerResponse {
readonly kind: EventTypesRegistry;
readonly typesRegistry: MapLike<MapLike<string>>;
@@ -86,7 +86,7 @@ export interface EndInstallTypes extends InstallTypes {
readonly installSuccess: boolean;
}
/* @internal */
/** @internal */
export interface InstallTypingHost extends JsTyping.TypingResolutionHost {
useCaseSensitiveFileNames: boolean;
writeFile(path: string, content: string): void;
@@ -104,5 +104,5 @@ export interface SetTypings extends ProjectResponse {
readonly kind: ActionSet;
}
/* @internal */
/** @internal */
export type TypingInstallerResponseUnion = SetTypings | InvalidateCachedTypings | TypesRegistryResponse | PackageInstalledResponse | InstallTypes | InitializationFailedResponse;