docs: fix JSDoc field for object parameter templateParams in Generator constructor #999
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Previously, we're using
String
as the field type oftemplateParams
, which was not correct, since we're bound to useObject.keys()
on it andObject.keys()
on string results on an array over the characters.The different behaviors between
Object<string, string>
,Object
, andString
can be seen in this sandbox: https://codesandbox.io/s/bold-cache-r4tw43?file=/src/index.js.Initially I wanted to go with just
Object
(as I mentioned on the issue), but apparently it accepts all kind of types, including string and numbers (which is wrong), so I went withRecord<string, string>
. Then, I saw the other object field types in the constructor and they are all usingObject<string, T>
, so I used that instead for consistency purposes.generator/lib/generator.js
Line 83 in 76c106b
As we could see from the sandbox, the result is as the following:
Related issue(s)
Fixes #985.