Skip to content

Add TypeScript type declarations#23

Open
Mearman wants to merge 8 commits intopebble-dev:mainfrom
Mearman:types
Open

Add TypeScript type declarations#23
Mearman wants to merge 8 commits intopebble-dev:mainfrom
Mearman:types

Conversation

@Mearman
Copy link
Copy Markdown

@Mearman Mearman commented Apr 19, 2026

Adds curated index.d.ts shipping with the package, covering the full public API including dynamic patterns (ClayEvents mixin, manipulator binding) that tsc --allowJs cannot infer. Includes CI validation.

Mearman added 8 commits April 19, 2026 09:46
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.
Configures tsc --allowJs --emitDeclarationOnly to generate per-file
.d.ts reference output in dist-types/ from the library source files.
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.
Exercises the full public API surface — constructor, instance/static
methods, ClayConfig/ClayItem event methods, manipulator methods,
namespace-exported types, and customFn this-context.
Adds typescript 6.0.2 as a devDependency. Sets "types": "index.d.ts"
in package.json. Adds build:types and check:types scripts.
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.
Add dist-types/ to .gitignore (build artefact). Whitelist index.d.ts
in .npmignore so type declarations ship with the package.
Runs npm run check:types on push and PR to main, matching the existing
lint/test/build workflow pattern.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant