Skip to content

Commit

Permalink
Add support for null types when deriving JSON from Sass variables (#1019
Browse files Browse the repository at this point in the history
) (#1020)

* Fix collapsible nav build error

Signed-off-by: Matt Provost <[email protected]>

* Update to unset

Signed-off-by: Matt Provost <[email protected]>

* Fix in derive sass variable types

Signed-off-by: Matt Provost <[email protected]>

* Update changelog

Signed-off-by: Matt Provost <[email protected]>

---------

Signed-off-by: Matt Provost <[email protected]>
(cherry picked from commit 8531d2a)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 606d478 commit 6535f9f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/derive-sass-variable-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ async function deriveSassVariableTypes(
function deriveValueType(extractedValue) {
switch (typeof extractedValue) {
case 'object':
if (extractedValue === null) {
return ts.createKeywordTypeNode(ts.SyntaxKind.NullKeyword);
}

return ts.createTypeLiteralNode(
Object.keys(extractedValue).map(key =>
ts.createPropertySignature(
Expand Down

0 comments on commit 6535f9f

Please sign in to comment.