Skip to content

Commit b3f0436

Browse files
authored
fix: Remove additional properties from exported interface (#17)
1 parent 1342c53 commit b3f0436

File tree

4 files changed

+2
-4
lines changed

4 files changed

+2
-4
lines changed

src/{{ project_name_snake }}/export_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def export_types(schema_file: str):
4949

5050
def generate_typescript_interfaces(schema_dir: Path):
5151
run_command(
52-
f"npx -y json-schema-to-typescript@15.0.4 -i '{schema_dir / '*.json'}' -o {schema_dir}"
52+
f"npx -y json-schema-to-typescript@15.0.4 -i '{schema_dir / '*.json'}' -o {schema_dir} --additionalProperties=false"
5353
)
5454
run_command(f"npx -y prettier@3.5.1 --write {schema_dir}")
5555

test-proj/src/test_proj/export_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def export_types(schema_file: str):
4949

5050
def generate_typescript_interfaces(schema_dir: Path):
5151
run_command(
52-
f"npx -y json-schema-to-typescript@15.0.4 -i '{schema_dir / '*.json'}' -o {schema_dir}"
52+
f"npx -y json-schema-to-typescript@15.0.4 -i '{schema_dir / '*.json'}' -o {schema_dir} --additionalProperties=false"
5353
)
5454
run_command(f"npx -y prettier@3.5.1 --write {schema_dir}")
5555

test-proj/ui/src/schemas/MySchema.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ export type Hello = string;
99

1010
export interface MySchema {
1111
hello: Hello;
12-
[k: string]: unknown;
1312
}

ui/src/schemas/MySchema.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ export type Hello = string;
99

1010
export interface MySchema {
1111
hello: Hello;
12-
[k: string]: unknown;
1312
}

0 commit comments

Comments
 (0)