Skip to content

Commit

Permalink
fix soundness issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Moeglich committed Oct 7, 2024
1 parent 09c283e commit c2114e8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "weaveconfig"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
description = "A unified configuration tool for monorepos"
readme = "README.md"
Expand Down
4 changes: 4 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"description": "Schema for validating the _space.jsonc configuration file in weaveconfig.",
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "The URI of the JSON Schema that this document adheres to."
},
"name": {
"type": "string",
"description": "The name of the space. This is used to identify the space in the graph. Dependencies reference spaces by their name. It must be unique within the graph."
Expand Down
2 changes: 1 addition & 1 deletion src/bin/weaveconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use weaveconfig::generate_weaveconfig;
#[derive(Parser)]
#[command(
name = "weaveconfig-cli",
version = "0.1.0",
version = "0.1.2",
author = "Jeremy Moeglich <[email protected]>",
about = "A CLI to manage weaveconfig configurations"
)]
Expand Down
10 changes: 9 additions & 1 deletion src/ts_binding/format_ts_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ fn json_value_to_ts_type_helper(value: &serde_json::Value, indent: usize) -> Str
let inner_indent_str = " ".repeat(indent + 1);

if map.is_empty() {
"Record<string, never>".to_string()
"Record<string, undefined>".to_string()
// using never is unsound, undefined is more accurate
// const a: Record<string, never> = {};
// const b: { test: string } = { test: "test" };
// const some_bool: boolean = false;

// const c = some_bool ? a : b;

// c.test // infered as string, should be string | undefined
} else {
let mut fields: Vec<String> = vec![];
for (key, val) in map {
Expand Down

0 comments on commit c2114e8

Please sign in to comment.