Skip to content

TSM-04: convert core entry and shared infra to TypeScript - #561

Open
Justin Hammond (Justintime50) wants to merge 3 commits into
ts-migrate/03-type-strategy-guardrailsfrom
ts-migrate/04-core-entry-shared-infra
Open

TSM-04: convert core entry and shared infra to TypeScript#561
Justin Hammond (Justintime50) wants to merge 3 commits into
ts-migrate/03-type-strategy-guardrailsfrom
ts-migrate/04-core-entry-shared-infra

Conversation

@Justintime50

@Justintime50 Justin Hammond (Justintime50) commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • rename core entry and shared modules to TypeScript: easypost, constants, util, internal_util
  • update Vite library entry to src/easypost.ts and resolve extensions for .ts + .js
  • keep runtime behavior unchanged while migration proceeds with temporary ts-nocheck on converted files
  • allow permissive incremental migration in source typecheck by setting noImplicitAny=false in tsconfig.build.json

Validation

  • npm run typescript
  • npm run build
  • npx eslint src/easypost.ts src/constants.ts src/utils/util.ts src/utils/internal_util.ts
  • npx vitest run test/services/module_exports_compat.test.js

@Justintime50 Justin Hammond (Justintime50) changed the title step4: convert core entry and shared utils to ts TSM-04: convert core entry and shared infra to TypeScript Aug 6, 2026
@Justintime50
Justin Hammond (Justintime50) force-pushed the ts-migrate/04-core-entry-shared-infra branch from 0af98c1 to de5a155 Compare August 6, 2026 21:29
@Justintime50
Justin Hammond (Justintime50) force-pushed the ts-migrate/04-core-entry-shared-infra branch from 58095f6 to 97ce5ac Compare August 7, 2026 19:28
@Justintime50
Justin Hammond (Justintime50) force-pushed the ts-migrate/04-core-entry-shared-infra branch 2 times, most recently from 9ef2479 to 809c70a Compare August 7, 2026 19:41
@Justintime50
Justin Hammond (Justintime50) force-pushed the ts-migrate/04-core-entry-shared-infra branch from 809c70a to 52b267f Compare August 7, 2026 19:49
@Justintime50
Justin Hammond (Justintime50) force-pushed the ts-migrate/04-core-entry-shared-infra branch from 52b267f to d3aceac Compare August 7, 2026 19:54
@Justintime50
Justin Hammond (Justintime50) force-pushed the ts-migrate/04-core-entry-shared-infra branch from d3aceac to a1c30e4 Compare August 7, 2026 20:00

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, mostly looks good. I would just strongly suggest keeping noImplicitAny disabled here.

Would also suggest stronger types on the client options, but that one is nonblocking.

Comment thread src/easypost.ts
Comment on lines +51 to +53
httpMiddleware?: any;
requestMiddleware?: any;
httpClient?: any;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question:
Hmmm... are these just stubs for later, or are these actually anything? For example, httpClient could now be initialized with 2 and it would be valid according to TS.

Ideally we would type these with what we expect. For example, httpClient: typeof fetch or similar.

Comment thread tsconfig.build.json
"compilerOptions": {
"allowJs": true,
"checkJs": false,
"noImplicitAny": false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:
I would strongly argue to keep this enabled. This can very easily allow type errors to get swept under the rug. If you create a new function, this no longer requires that function's parameters to be typed.

const getFooBar = (arg) => arg.foo.bar;
// ...
getFooBar("abc")

now compiles fine, even though this will be a runtime error.

@Justintime50
Justin Hammond (Justintime50) marked this pull request as ready for review August 12, 2026 20:27
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.

2 participants