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
)

* 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]>
  • Loading branch information
BSFishy authored Sep 5, 2023
1 parent 1230223 commit 8531d2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

- Fix blurry text in breadcrumbs by avoiding skewing text ([#959](https://github.com/opensearch-project/oui/pull/959))
- Remove `calc` usage from SchemaItem styles ([#990](https://github.com/opensearch-project/oui/pull/990))
- Add support for null types when deriving JSON from Sass variables ([#1019](https://github.com/opensearch-project/oui/pull/1019))

### 🚞 Infrastructure

Expand Down
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 8531d2a

Please sign in to comment.