Closed revmischa closed 11 months ago
Man, jsii
is a big headache.
@revmischa looks like this commit removed the any
discussed here in v2.0.5.
We were using the distribution
to set custom domain thing and some other properties, but now this complains that not all the other properties are implemented. We do not want to implement all of them, just some.
new Nextjs(this, "NextLambdaEdge", {
nextjsPath: "../next",
projectRoot: "..",
defaults: {
distribution: {
customDomain: {
domainName: props.reactDomainName,
hostedZone: HostedZone.fromHostedZoneAttributes(this, "HostedZone", <HostedZoneAttributes>{
hostedZoneId: props.hostedZoneId,
zoneName: props.zoneName
}),
certificate: Certificate.fromCertificateArn(this, "Certificate", props.certificateArn)
},
cdk: {
distribution: { webAclId: props.webAclId }
}
}
}
});
What is the correct approach now that the any
was removed?
Ok I see now that this causes a type error in 2.0.5. I will revert the change.
I just don't know how to get around this jsii limitation. The correct type should be Partial<NextjsDistributionProps>
but jsii won't permit you to use Partial<>
because it isn't cross-language compatible. I was hoping any | NextjsDistributionProps
would allow you to pass whatever but still give you code hinting, but perhaps not.
It's not possible to use Partial<>
with JSII :(. Closing.
Right now
defaults.distribution
anddefaults.assetDeployment
areany
This is a limitation in jsii we need to figure out a workaround for I want the type to be e.g.Partial<DistributionProps>
but we can't usePartial<>
in jsiiSee this thread on the CDK slack for more details: https://cdk-dev.slack.com/archives/C01C8R4K2E6/p1665107002345799