Skip to content

Commit

Permalink
feat(utilities): add typescript declarations to dist (#17797)
Browse files Browse the repository at this point in the history
  • Loading branch information
janhassel authored Oct 21, 2024
1 parent c1c8a8b commit a8f6da7
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/utilities-react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
types
8 changes: 6 additions & 2 deletions packages/utilities-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "Apache-2.0",
"main": "lib/index.js",
"module": "es/index.js",
"types": "types/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/carbon-design-system/carbon.git",
Expand All @@ -30,7 +31,8 @@
"scripts": {
"build:es": "esbuild ./src/**/!(*-test).{js,ts,jsx,tsx} --minify --outdir=es --target=es2020 --format=esm",
"build:cjs": "esbuild ./src/**/!(*-test).{js,ts,jsx,tsx} --minify --outdir=lib --target=es2020 --format=cjs",
"build": "yarn build:es & yarn build:cjs",
"build:types": "tsc",
"build": "yarn build:es & yarn build:cjs & yarn build:types",
"watch": "yarn build:es --watch & yarn build:cjs --watch",
"clean": "rimraf es lib",
"test": "echo yay && exit 0",
Expand All @@ -41,7 +43,9 @@
},
"devDependencies": {
"esbuild": "^0.24.0",
"rimraf": "^6.0.0"
"rimraf": "^6.0.0",
"typescript": "^4.8.4",
"typescript-config-carbon": "^0.3.0"
},
"dependencies": {
"@carbon/utilities": "^0.1.0",
Expand Down
10 changes: 10 additions & 0 deletions packages/utilities-react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "typescript-config-carbon/tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"declarationDir": "./types"
},
"include": ["src/**/*"],
"exclude": ["src/**/*-test.js"]
}
1 change: 1 addition & 0 deletions packages/utilities/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
types
8 changes: 6 additions & 2 deletions packages/utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "Apache-2.0",
"main": "lib/index.js",
"module": "es/index.js",
"types": "types/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/carbon-design-system/carbon.git",
Expand All @@ -29,15 +30,18 @@
"scripts": {
"build:es": "esbuild ./src/**/!(*-test).{js,ts} --minify --outdir=es --target=es2020 --format=esm",
"build:cjs": "esbuild ./src/**/!(*-test).{js,ts} --minify --outdir=lib --target=es2020 --format=cjs",
"build": "yarn build:es & yarn build:cjs",
"build:types": "tsc",
"build": "yarn build:es & yarn build:cjs & yarn build:types",
"watch": "yarn build:es --watch & yarn build:cjs --watch",
"clean": "rimraf es lib",
"test": "echo yay && exit 0",
"postinstall": "ibmtelemetry --config=telemetry.yml"
},
"devDependencies": {
"esbuild": "^0.24.0",
"rimraf": "^6.0.0"
"rimraf": "^6.0.0",
"typescript": "^4.8.4",
"typescript-config-carbon": "^0.3.0"
},
"dependencies": {
"@ibm/telemetry-js": "^1.6.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/utilities/src/dateTimeFormat/absolute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export function format(
}

export function formatRange(
startDate: Date | Number,
endDate: Date | Number,
startDate: Date | number,
endDate: Date | number,
options?: Partial<{
locale: string;
style: Intl.DateTimeFormatOptions['timeStyle'];
Expand Down
10 changes: 10 additions & 0 deletions packages/utilities/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "typescript-config-carbon/tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
"declarationDir": "./types"
},
"include": ["src/**/*"],
"exclude": ["src/**/*-test.js"]
}
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2285,6 +2285,8 @@ __metadata:
"@ibm/telemetry-js": "npm:^1.6.1"
esbuild: "npm:^0.24.0"
rimraf: "npm:^6.0.0"
typescript: "npm:^4.8.4"
typescript-config-carbon: "npm:^0.3.0"
peerDependencies:
react: ^16.8.6 || ^17.0.1 || ^18.2.0
languageName: unknown
Expand All @@ -2297,6 +2299,8 @@ __metadata:
"@ibm/telemetry-js": "npm:^1.6.1"
esbuild: "npm:^0.24.0"
rimraf: "npm:^6.0.0"
typescript: "npm:^4.8.4"
typescript-config-carbon: "npm:^0.3.0"
languageName: unknown
linkType: soft

Expand Down

0 comments on commit a8f6da7

Please sign in to comment.