Skip to content

Commit 47972e4

Browse files
authored
output d.ts files (#1037)
* output d.ts files * package.json - also include src/**/*.ts files * package.json - also include types/**/*.d.ts files
1 parent 8065e59 commit 47972e4

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
dist/
3+
types/
34
node_modules/
45
test/output/*-changed.svg
56
test/output/*-changed.html

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
},
2424
"files": [
2525
"dist/**/*.js",
26-
"src/**/*.js"
26+
"src/**/*.js",
27+
"src/**/*.ts",
28+
"types/**/*.d.ts"
2729
],
2830
"scripts": {
2931
"test": "yarn test:typecheck && yarn test:lint && yarn readme:check && yarn test:mocha",

src/format.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ const numberFormat = memoize1<Intl.NumberFormat>(
88
);
99
const monthFormat = memoize1<Intl.DateTimeFormat>(
1010
(locale: string | string[] | undefined, month: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined) =>
11-
new Intl.DateTimeFormat(locale, {timeZone: "UTC", month})
11+
new Intl.DateTimeFormat(locale, {timeZone: "UTC", ...(month && {month})})
1212
);
1313
const weekdayFormat = memoize1<Intl.DateTimeFormat>(
1414
(locale: string | string[] | undefined, weekday: "long" | "short" | "narrow" | undefined) =>
15-
new Intl.DateTimeFormat(locale, {timeZone: "UTC", weekday})
15+
new Intl.DateTimeFormat(locale, {timeZone: "UTC", ...(weekday && {weekday})})
1616
);
1717

1818
export function formatNumber(locale = "en-US"): (value: any) => string | undefined {

tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"stripInternal": true,
88
"outDir": "dist",
99
"allowJs": true,
10+
"declaration": true,
11+
"declarationDir": "types",
1012
"resolveJsonModule": true,
1113
"moduleResolution": "node",
1214
"paths": {

0 commit comments

Comments
 (0)