Skip to content

brevo-api: Fix unresolvable src/... imports in the published type declarations - #6453

Open
VPS-Obi wants to merge 1 commit into
nextfrom
claude/laughing-noether-7g7db3
Open

VPS-Obi wants to merge 1 commit into
nextfrom
claude/laughing-noether-7g7db3

Conversation

@VPS-Obi

@VPS-Obi VPS-Obi commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Some brevo-api sources imported internal types via bare src/... specifiers. They only resolved inside the package (through baseUrl) and were emitted unchanged into the published .d.ts files. Consuming projects can't resolve them, so these types silently became any, for instance EmailCampaignScopeInterface and large parts of the BrevoModule.register() config. The imports are now relative, and baseUrl is gone so that bare src/... imports fail to compile.

Once the types resolve, the scope callbacks in the config reject the application's own scope class under strictFunctionTypes: (scope: EmailCampaignContentScope) => ... isn't assignable to (scope: Record<string, any>) => .... To fix this, BrevoModuleConfig is now generic over the scope type, and BrevoModule.register() infers it from emailCampaigns.Scope. This way brevo.resolveConfig and emailCampaigns.frontend can be typed with the application's scope class without casts:

BrevoModule.register({
    brevo: {
        resolveConfig: (scope: EmailCampaignContentScope) => {
            /* ... */
        },
        // ...
    },
    emailCampaigns: {
        Scope: EmailCampaignContentScope,
        frontend: (scope: EmailCampaignContentScope) => {
            /* ... */
        },
        // ...
    },
});

The type parameter has a default, so existing references to BrevoModuleConfig keep working. Projects whose config was only accepted because it was typed as any may now get type errors.

Session: https://claude.ai/code/session_01PJLvtQHLoB2B8Qsfxvo9Pw

@VPS-Obi
VPS-Obi force-pushed the claude/laughing-noether-7g7db3 branch from 3a85821 to 8e211b4 Compare September 24, 2026 13:46
@VPS-Obi VPS-Obi changed the title Fix unresolvable src/... imports in published type declarations brevo-api: Fix unresolvable src/... imports in the published type declarations Sep 24, 2026
@VPS-Obi
VPS-Obi changed the base branch from main to next September 24, 2026 13:47
@VPS-Obi
VPS-Obi marked this pull request as ready for review September 24, 2026 13:47

VPS-Obi commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review


Generated by Claude Code

@VPS-Obi
VPS-Obi changed the base branch from next to mail-react/tiptap-rte September 24, 2026 13:51
@VPS-Obi
VPS-Obi changed the base branch from mail-react/tiptap-rte to next September 24, 2026 13:52
@greptile-apps

greptile-apps Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

The PR should satisfy the repository’s binding import convention before merging.

Fix All in Claude CodeFindings

  1. P2 Cross-module relative imports ▶

Summary

The PR replaces bare src/... imports with relative imports and makes the Brevo configuration generic over the application’s campaign scope.

  • The previously reviewed consumer-coverage concern was resolved after the author explained the existing build and demo type-check coverage.
  • The converted cross-module imports conflict with the repository’s binding TypeScript import convention.

Reviews (3) · Last reviewed commit: "brevo-api: Use relative imports so publi..."

Comment thread packages/api/brevo-api/src/config/brevo-module.config.ts

VPS-Obi commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Replies to the Greptile findings (both non-blocking):

  1. Published types lack consumer coverage: won't add it in this PR. Removing baseUrl means a bare src/... import no longer compiles in the package build, which already prevents this regression. demo/api's lint:tsc also type-checks BrevoModule.register() against the built declarations.
  2. Metadata discovery lacks test coverage: blocks-meta.service.ts isn't part of this PR. The review looks like it ran against the pre-retarget base and picked up commits that are already on next.

Generated by Claude Code

@greptile-apps

greptile-apps Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Comments Outside Diff

These findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.

  • P2 Metadata discovery lacks test coverage. packages/api/cms-api/src/blocks/blocks-meta.service.ts:26 ▶

    Production now discovers root blocks before generating block-meta.json, while the new tests pass root blocks directly to the traversal function. If discovery misses a root, those tests can still pass while the written metadata is incomplete. A service-level test of discovery through file generation would cover that gap.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Bare `src/...` specifiers were emitted unchanged into the `.d.ts` files, so consuming projects couldn't resolve them and the affected types became `any`. Replace them with relative imports and drop `baseUrl` from the tsconfig so they can't creep back in.

With the types resolving, the scope callbacks in the module config rejected the application's own scope class under `strictFunctionTypes`. Make `BrevoModuleConfig` generic over the scope type so `BrevoModule.register()` infers it from `emailCampaigns.Scope`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJLvtQHLoB2B8Qsfxvo9Pw
@VPS-Obi
VPS-Obi force-pushed the claude/laughing-noether-7g7db3 branch from 8e211b4 to b57f429 Compare September 24, 2026 13:59
Comment thread packages/api/brevo-api/src/config/brevo-module.config.ts

This branch has not been deployed

No deployments
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