Skip to content

interface A extends B fails if B is exported from a private file #2082

@rix0rrr

Description

@rix0rrr

The following succeeds:

export interface A extends B { /* ... */ }

interface B { /* ... */ }

It will "hide" the interface B entirely from jsii.

But the following fails:

import { B } from './private/b';

export interface A extends B { /* ... */ }

With the error "can't find B, make sure it's exported".

Even though it's the exact same situation.

aws-cloudwatch/lib/alarm.ts:33:1 - error JSII9002: Unable to resolve type "aws-cdk-lib.CreateAlarmOptionsBase". It may be @internal or not exported from the module's entry point (as configured in "package.json" as "main").

Adding @internal to B does appease jsii, but this still shouldn't happen this way.

Probable reason

I'm guessing that the code that checks whether or not the B type should be hidden or should be visible looks at the export keyword and nothing else, but it B must have export if it comes from a different file, even if that file is itself not exported on purpose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions