-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tokens): enable type coercion (#2680)
Relax restrictions on input types for Token.toXxx in order to allow flexible type coercion. This may be needed in situations where users want to force a token typed as one type to be represented as another type and generally allow tokens to be used as "type-system escape hatches". Previously, this did not work: const port = new Token({ "Fn::GetAtt": [ "ResourceId", "Port" ] }).toString(); new TcpPort(new Token(port).toNumber()); Also, this did not work: const port = new Token({ "Fn::GetAtt": [ "ResourceId", "Port" ]}).toNumber(); These were just examples. The point is that if a user reached the point where you actually need a token, they basically indicate to the framework that “I know what I am are doing”. It’s a sort of an “as any” at the framework level. Fixes #2679
- Loading branch information
Elad Ben-Israel
authored
Jun 2, 2019
1 parent
dcfd9d2
commit 0f54698
Showing
2 changed files
with
98 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters