Files
clay/tsconfig.declarations.json
Joseph Mearman 7512b6436b Add TypeScript type declarations (#23)
* feat: add ambient module stubs for declaration generation

Provide TypeScript ambient declarations for 'message_keys' (Pebble SDK
module) and './tmp/config-page.html' (build artefact) so tsc can resolve
these imports when generating .d.ts files.

* feat: add tsconfig for declaration generation

Configures tsc --allowJs --emitDeclarationOnly to generate per-file
.d.ts reference output in dist-types/ from the library source files.

* feat: add curated TypeScript declarations for public API

Hand-curated index.d.ts covering Clay, ClayConfig, ClayItem, ClayEvents,
manipulators, and all supporting types. Necessary because tsc cannot
infer the ClayEvents mixin or dynamically-bound manipulator methods.
All types are exported via the Clay namespace.

* test: add type-checking verification for index.d.ts

Exercises the full public API surface — constructor, instance/static
methods, ClayConfig/ClayItem event methods, manipulator methods,
namespace-exported types, and customFn this-context.

* build: add typescript devDependency, types field, and build scripts

Adds typescript 6.0.2 as a devDependency. Sets "types": "index.d.ts"
in package.json. Adds build:types and check:types scripts.

* build: add gulp types task to validate declarations on build

Validates index.d.ts against test/type-checks.ts as part of the default
gulp build. Reference declaration generation via build:types remains
available as a separate manual step.

* chore: update ignore files for TypeScript declarations

Add dist-types/ to .gitignore (build artefact). Whitelist index.d.ts
in .npmignore so type declarations ship with the package.

* ci: add typecheck workflow to validate TypeScript declarations

Runs npm run check:types on push and PR to main, matching the existing
lint/test/build workflow pattern.
2026-05-21 22:33:48 +02:00

34 lines
767 B
JSON

{
"compilerOptions": {
"target": "ES2015",
"module": "node16",
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"rootDir": ".",
"outDir": "./dist-types",
"strict": false,
"skipLibCheck": true,
"moduleResolution": "node16",
"typeRoots": ["./types", "./node_modules/@types"]
},
"include": [
"src/scripts/lib/clay-config.js",
"src/scripts/lib/clay-events.js",
"src/scripts/lib/clay-item.js",
"src/scripts/lib/component-registry.js",
"src/scripts/lib/manipulators.js",
"src/scripts/lib/utils.js"
],
"exclude": [
"node_modules",
"test",
"dev",
"tmp",
"src/scripts/config-page.js",
"src/scripts/components",
"src/scripts/vendor",
"src/js"
]
}