-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to resolve unexported referenced type when moved #1980
Comments
Also, just noticed the typo in the error message above: https://github.com/aws/jsii/blob/master/packages/jsii/lib/jsii-diagnostic.ts#L710 Worth fixing that at the same time? :D |
Your un-exported (from the package) type is exported from the module (i.e: file) that defines it. It must be annotated with I guess it'd be sweet if we could have a warning that this non- |
See #10130 (review) for original motivation. Moves `DatabaseClusterBaseProps`, `DatabaseClusterBase`, `DatabaseClusterNew`, and `ImportedDatabaseCluster` from `cluster.ts` to `private/cluster-internal.ts`. Note that `DatabaseClusterBase` was previously publicly exported; however, that change has not yet been release, so as long as this is merged before the next release this won't be a breaking change. Originally, I thought this refactoring was blocked by aws/jsii#1980 but thanks to a clarification, I realized I just needed to mark the private classes as `@internal`.
See #10130 (review) for original motivation. Moves `DatabaseClusterBaseProps`, `DatabaseClusterBase`, `DatabaseClusterNew`, and `ImportedDatabaseCluster` from `cluster.ts` to `private/cluster-internal.ts`. Note that `DatabaseClusterBase` was previously publicly exported; however, that change has not yet been release, so as long as this is merged before the next release this won't be a breaking change. Originally, I thought this refactoring was blocked by aws/jsii#1980 but thanks to a clarification, I realized I just needed to mark the private classes as `@internal`.
Thanks for the clarification; I agree a more explicit warning in this case would be really useful. |
If we're going to that I'd like to combine this with other heuristics: that a type in a |
One snag with the proposed workaround -- other consuming modules see the imports for the unexported classes/interfaces in the See aws/aws-cdk#10338 and the subsequent build failure. Build log failure
Note that the above build failures are for the |
Yeah we need to not erase
This would be a breaking change; and this looks too much like opinions forced on developers, which I'm not too favorable to. |
I tried to update one of my constructs to cdk v2 and apparently hit this issue(?). Is there anything I can do to work around this or is it even something I can workaround as a library user? You can find full details of the error in this gist. |
I'm also getting this - i have a method that returns a CDK API Gateway class and JSII ` export class ApiGatewayHelpers { error JSII3002: Type "aws-cdk-lib.EndpointConfiguration" cannot be used as a return type because it is not exported from aws-cdk-lib 9 public static endpointConfiguration(stack: Stack, group?: string): api.EndpointConfiguration { node_modules/aws-cdk-lib/aws-apigateway/lib/restapi.d.ts:626:1 |
@nlongton - It sounds like you may be running into aws/aws-cdk#17860. Can you leave a comment there as well? |
🐛 Bug Report
Affected Languages
TypeScript
orJavascript
Python
Java
C#
,F#
, ...)General Information
What is the problem?
When refactoring unexported (supporting) types from inline in the same file as exported types to another (unexported) file, jsii loses the ability to resolve the types.
This works
index.ts
has-unexported-base.ts
This doesn't
index.ts
has-unexported-base.ts
private/unexported-base.ts
Verbose Log
Verbose output
The text was updated successfully, but these errors were encountered: