Skip to content

Commit 8c0e3c4

Browse files
author
Rudolf Meijering
committed
treat types as an alias for typings in package.json
According to https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html `types` is an alias for `typings`. This commit updates api-extractor to infer configuration from both of these properties.
1 parent 9e17b70 commit 8c0e3c4

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

apps/api-extractor/bin/api-extractor

100644100755
File mode changed.

common/reviews/api/node-core-library.api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ interface IPackageJson {
269269
tsdoc?: IPackageJsonTsdocConfiguration;
270270
// @beta
271271
tsdocMetadata?: string;
272+
types?: string;
272273
typings?: string;
273274
version: string;
274275
}

libraries/node-core-library/src/IPackageJson.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ export interface IPackageJson {
9595
* The path to the TypeScript *.d.ts file describing the module file
9696
* that will act as the main entry point.
9797
*/
98+
types?: string;
99+
100+
/**
101+
* Alias for `types`
102+
*/
98103
typings?: string;
99104

100105
/**

libraries/node-core-library/src/PackageJsonLookup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export class PackageJsonLookup {
224224
packageJson.peerDependencies = loadedPackageJson.peerDependencies;
225225
packageJson.private = loadedPackageJson.private;
226226
packageJson.scripts = loadedPackageJson.scripts;
227-
packageJson.typings = loadedPackageJson.typings;
227+
packageJson.typings = loadedPackageJson.typings || loadedPackageJson.types;
228228
packageJson.tsdoc = loadedPackageJson.tsdoc;
229229
packageJson.tsdocMetadata = loadedPackageJson.tsdocMetadata;
230230
packageJson.version = loadedPackageJson.version;

0 commit comments

Comments
 (0)