Skip to content

Conversation

@erikfried
Copy link
Contributor

No description provided.

erikfried and others added 9 commits November 25, 2025 17:07
- Add TypeScript configuration (tsconfig.json) with moderate strictness
- Add type declarations for tiny-emitter library
- Convert all source files to TypeScript:
  - Remove 'use strict' directives
  - Change imports from .js to extensionless
  - Add type annotations to functions, classes, and properties
- Update build tooling:
  - Add TypeScript compilation step to build.sh
  - Update jest.config.js for TypeScript support
  - Update .eslintrc.yml with TypeScript rules
  - Update package.json with TypeScript dependencies and scripts
- Delete manual .d.ts files (TypeScript will generate them)
- Add CLAUDE.md for repository documentation

All files now compile successfully with TypeScript.
Fixed a bug introduced during TypeScript conversion where RESTClient was
being instantiated with pre-mapped URLs, causing urlMapper to be called
twice (once in setter methods, then again in RESTClient constructor).

Changes:
- Fixed RESTClient instantiation in Identity, Monetization, and Payment
  classes to pass envDic parameter instead of pre-mapping URLs with
  urlMapper
- Restored complete RESTClient mock implementation with proper makeUrl,
  get, and go methods to match original JavaScript version
- Mock now includes URL encoding logic and Fixtures integration for test
  data

All 264 tests now passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Reverted the import statements to use .js extensions as they were in the
original JavaScript codebase. TypeScript supports .js extensions in imports
when targeting ES modules, and this maintains consistency with the original
code structure.

Changed all imports from:
  import foo from './bar'
to:
  import foo from './bar.js'

All tests, type-checking, and linting still pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Replace any types with generic type parameter T in the Cache class to improve type safety. Consumers can now optionally specify the cached value type when creating Cache instances.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Convert all @typedef declarations in identity.ts to proper TypeScript interfaces
- Add CachedObject<T> interface in cache.ts for typed cache storage
- Remove redundant JSDoc type annotations (replaced by TypeScript types)
- Keep descriptive comments in JSDoc format for documentation
- Export all interfaces for use by consumers

This improves type safety and enables better IDE support with proper TypeScript types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Create IdentityOptions interface for Identity constructor parameters
- Update Identity class properties with proper types (Cache<any>, RESTClient, Window)
- Add default parameter to RESTClient.get() method signature
- Add null check for optional callbackBeforeRedirect before invocation
- Remove redundant JSDoc type annotations replaced by TypeScript types

This improves type safety and IDE support for Identity class usage.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Create IdentityOptions interface for Identity constructor parameters
- Update Identity class properties with proper types (Cache<any>, RESTClient, Window)
- Add default parameter to RESTClient.get() method signature
- Add null check for optional callbackBeforeRedirect before invocation
- Remove redundant JSDoc type annotations replaced by TypeScript types

This improves type safety and IDE support for Identity class usage.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@erikfried erikfried changed the title Feat/ts claude 2 refactor: go typescript Nov 27, 2025
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