Skip to content
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

Explicit mapping between preflight classes and inflight classes in SDK #243

Closed
Chriscbr opened this issue Oct 9, 2022 · 1 comment · Fixed by #447
Closed

Explicit mapping between preflight classes and inflight classes in SDK #243

Chriscbr opened this issue Oct 9, 2022 · 1 comment · Fixed by #447
Labels

Comments

@Chriscbr
Copy link
Contributor

Chriscbr commented Oct 9, 2022

Right now the Wing SDK includes all of a resource's inflight operations in a separate interface to distinguish them from the preflight class's code and methods. (The interface is also used to type check that every inflight client implements the same operations, e.g. AwsBucketClient extends IBucketClient, AzureBucketClient extends IBucketClient, and so on). The compiler expects every preflight class named Blah to have an interface named IBlahClient in order to merge these into a single type in the type checker.

Instead of a convention, let's annotate the relationship explicitly:

 /**
  * Represents a cloud object store.
+ * @inflight @monadahq/wingsdk.cloud.IBucketClient
  */
 export class Bucket extends BucketBase {
@Chriscbr
Copy link
Contributor Author

Chriscbr commented Oct 22, 2022

@inflight annotations have been added to the SDK in a recent commit, just need to update the compiler to use this when importing jsii modules. The code that needs to be updated is here:

https://github.com/monadahq/winglang/blob/3aa544da00e6907a4dc9258a25b73117537de5e9/libs/wingc/src/type_check/jsii_importer.rs#L370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant