Skip to content

Commit 7955675

Browse files
authored
feat: migrate @carbon/elements to TypeScript (#22170)
1 parent e8d4b6d commit 7955675

5 files changed

Lines changed: 28 additions & 4 deletions

File tree

packages/elements/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"version": "11.89.0-rc.0",
55
"license": "Apache-2.0",
66
"main": "lib/index.js",
7+
"types": "lib/index.d.ts",
78
"module": "es/index.js",
89
"sass": "index.scss",
910
"repository": {
@@ -15,7 +16,6 @@
1516
"files": [
1617
"es",
1718
"lib",
18-
"src",
1919
"umd",
2020
"index.scss",
2121
"telemetry.yml"
@@ -34,7 +34,8 @@
3434
"provenance": true
3535
},
3636
"scripts": {
37-
"build": "yarn clean && carbon-cli bundle src/index.js --name CarbonElements",
37+
"build:types": "tsc -p tsconfig.types.json",
38+
"build": "yarn clean && carbon-cli bundle src/index.ts --name CarbonElements && yarn build:types",
3839
"clean": "rimraf es lib umd",
3940
"postinstall": "ibmtelemetry --config=telemetry.yml"
4041
},
@@ -52,6 +53,8 @@
5253
"@carbon/cli": "^11.43.0",
5354
"fs-extra": "^11.0.0",
5455
"klaw-sync": "^6.0.0",
55-
"rimraf": "^6.0.1"
56+
"rimraf": "^6.0.1",
57+
"typescript": "^5.7.3",
58+
"typescript-config-carbon": "workspace:^0.9.0"
5659
}
5760
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright IBM Corp. 2018, 2023
2+
* Copyright IBM Corp. 2018, 2026
33
*
44
* This source code is licensed under the Apache-2.0 license found in the
55
* LICENSE file in the root directory of this source tree.

packages/elements/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "typescript-config-carbon/tsconfig.base.json",
3+
"compilerOptions": {
4+
"declaration": false,
5+
"emitDeclarationOnly": false
6+
},
7+
"include": ["src/**/*"],
8+
"exclude": ["src/**/*.test.ts", "src/**/*.test.js", "src/**/__tests__/**"]
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"declaration": true,
5+
"emitDeclarationOnly": true,
6+
"declarationDir": "./lib"
7+
},
8+
"include": ["src/**/*"],
9+
"exclude": ["src/**/*.test.ts", "src/**/*.test.js", "src/**/__tests__/**"]
10+
}

yarn.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,8 @@ __metadata:
17601760
fs-extra: "npm:^11.0.0"
17611761
klaw-sync: "npm:^6.0.0"
17621762
rimraf: "npm:^6.0.1"
1763+
typescript: "npm:^5.7.3"
1764+
typescript-config-carbon: "workspace:^0.9.0"
17631765
languageName: unknown
17641766
linkType: soft
17651767

0 commit comments

Comments
 (0)