Skip to content

Commit 2cd7804

Browse files
authored
Merge pull request microsoft#1115 from skaapgif/rudolf-add-types-to-packagejson
Treat types as an alias for typings in package.json
2 parents 3632d91 + 4934480 commit 2cd7804

5 files changed

Lines changed: 18 additions & 1 deletion

File tree

apps/api-extractor/bin/api-extractor

100644100755
File mode changed.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/node-core-library",
5+
"comment": "Treat `types` as an alias for `typings` in package.json",
6+
"type": "minor"
7+
}
8+
],
9+
"packageName": "@microsoft/node-core-library",
10+
"email": "skaapgif@users.noreply.github.com"
11+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ interface IPackageJson {
275275
tsdoc?: IPackageJsonTsdocConfiguration;
276276
// @beta
277277
tsdocMetadata?: string;
278+
types?: string;
278279
typings?: string;
279280
version: string;
280281
}

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)