Add TypeScript type declarations#23
Open
Mearman wants to merge 8 commits intopebble-dev:mainfrom
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds curated
index.d.tsshipping with the package, covering the full public API including dynamic patterns (ClayEvents mixin, manipulator binding) thattsc --allowJscannot infer. Includes CI validation.