Allow Custom String Representation of Constructs #361
Labels
cdktf
enhancement
New feature or request
priority/backlog
Low priority (though possibly still important). Unlikely to be worked on within the next 6 months.
upstream/jsii
Pending upstream work on JSII
Community Note
Description
For some constructs / resources allowing custom type coercions could be very useful to enable an idiomatic usage.
For
TerraformLocals
I think it would make sense to add the following to the Typescript classes.This would allow to use it like
my-first-table-${local}
rather thanmy-first-table-${local.asString}
.The issue is, that this would only work for Typescript, but none of the other target languages. Python would look like this:
"my-first-sns-topic-<cdktf.TerraformLocal object at 0x10cd45190>"
It doesn't look like, that Jsii is handling this automatically if there's
toString()
function defined. Defining the required method for Python in the Typescript class manually only works as@internal
and therefore wouldn't be compiled via jsii.I think there are more cases where this becomes relevant. In the best case this would be addressed in Jsii directly.
References
toString
should implicitly always proxy to jsii aws/jsii#380The text was updated successfully, but these errors were encountered: