Compile-time resource/data type name for TypeScript bindings
See original GitHub issueCommunity Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave “+1” or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
Right now, generated TypeScript for the various available providers (@cdktf/provider-aws
, @cdktf/provider-github
, etc.) offer classes where the Terraform type is available as a static readonly string:
// .d.ts
export declare class LambdaFunction extends cdktf.TerraformResource {
static readonly tfResourceType: string;
// ...
}
// .ts
class LambdaFunction extends cdktf.TerraformResource {
constructor(scope, id, config) {
super(scope, id, {
terraformResourceType: 'aws_lambda_function'
// ...
});
}
}
While already convenient, this prevents doing some compile-time designs as the value is a simple string
from TypeScript’s point of view.
As the value is known ahead of time and does not change, it would be nice having it directly available in the declaration:
// .d.ts
export declare class LambdaFunction extends cdktf.TerraformResource {
static readonly tfResourceType: 'aws_lambda_function';
// ...
}
References
n/a
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Obtain the name of a Generic on compile time - Stack Overflow
TL;DR: no, there's no good way to do this. In your example, the type named MyClass is the interface given to instances of...
Read more >Documentation - SolidJS · Reactive Javascript Library
A declarative, efficient and flexible JavaScript library for building user interfaces.
Read more >Safari Technology Preview Release Notes - Apple Developer
Preview the new type of phishing-resistant credential that makes signing in to websites safer and easier. Available through Safari's WebAuthn platform ...
Read more >Vehlmell - Bitsavers.org
ACllON: In Typescript, enter the command. 'echo foobar /dev/console. RESULT: The word "foobar" followed by a timestamp should appear in the Em>rLog, ...
Read more >@profusion/json-schema-to-typescript-definitions - npm
This is a TypeScript definitions that can automatically generate TypeScript types given JSON Schema definitions without the need of any code ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Merged https://github.com/hashicorp/terraform-cdk/pull/1535
I’m going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you’ve found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.