Skip to content

Fix dev-only lint errors in universal-kyc packages - #10154

Merged
mcmire merged 3 commits into
mainfrom
fix-lint-errors/universal-kyc-team
Sep 9, 2026
Merged

Fix dev-only lint errors in universal-kyc packages#10154
mcmire merged 3 commits into
mainfrom
fix-lint-errors/universal-kyc-team

Conversation

@mcmire

@mcmire mcmire commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Explanation

Currently, there are some type errors that exist in packages owned by @MetaMask/universal-kyc. These type errors are not present in production code, so they are not flagged by yarn build, but they will be flagged soon by yarn lint:tsc, and so we need to fix them.

The notable change here is that since @metamask/profile-sync-controller has custom subpath exports, they need to be added to the mapping in tsconfig.packages.json to ensure that TypeScript traces types imported via these subpaths back to files in src/, not to files in dist/.

References

https://consensyssoftware.atlassian.net/browse/WPC-1275

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Test-only and TypeScript path-mapping changes with no production logic edits; verify the user-storage paths entry uses ${configDir}/../ (the diff shows a possible missing slash) and that Jest mappings stay aligned.

Overview
Prepares universal-kyc packages for yarn lint:tsc by fixing type/lint issues in tests and monorepo TypeScript resolution—no production KYC behavior changes in the diff.

tsconfig.packages.json adds explicit paths for @metamask/profile-sync-controller/auth and .../user-storage so subpath imports resolve to src/ instead of dist/, matching the pattern used for other in-repo packages (and intended to stay in sync with Jest’s moduleNameMapper).

KYC controller/service tests drop unnecessary suppressions and casts: the missing T&C2 @ts-expect-error is removed, messenger setup uses a spread on SERVICE_ACTIONS, KycService construction passes the messenger without a MockAnyNamespace cast, and a nock 409 body is sent as the string 'null' instead of JSON null. testToken.test.ts types decoded token payloads as UkycStorageAccessTokenPayload instead of a loose record.

Reviewed by Cursor Bugbot for commit 6c4115b. Bugbot is set up for automated code reviews on this repo. Configure here.

Currently, there are some type errors that exist in delegation packages.
These type errors are not present in production code, so they are not
flagged by `yarn build`, but they _will_ be flagged soon by `yarn
lint:tsc`, and so we need to fix them.

The notable change here is that since
`@metamask/profile-sync-controller` has custom subpath exports, they
need to be added to the mapping in `tsconfig.packages.json` to ensure
that TypeScript resolves types from source files, _not_ built files.
@mcmire
mcmire marked this pull request as ready for review September 9, 2026 17:00
@mcmire
mcmire requested a review from a team as a code owner September 9, 2026 17:00
@mcmire
mcmire deployed to default-branch September 9, 2026 17:00 — with GitHub Actions Active
*/
function decodeHeader(header: string): {
payload: Record<string, unknown>;
payload: UkycStorageAccessToken['payload'];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why not UkycStorageAccessTokenPayload directly? I don't really mind either way, just wondering if this was explicit or not

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You're right! No specific reason except that this was done by AI (along with a bunch of other type fixes in a bunch of other files). Switched to UkycStorageAccessTokenPayload in 6c4115b

jiexi
jiexi previously approved these changes Sep 9, 2026

@jiexi jiexi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you, sir 🫡

@mcmire
mcmire added this pull request to the merge queue Sep 9, 2026
Merged via the queue into main with commit aa71532 Sep 9, 2026
335 checks passed
@mcmire
mcmire deleted the fix-lint-errors/universal-kyc-team branch September 9, 2026 20:19
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