Skip to content

Adds type safety for schema roles and refines generic signatures#75

Open
montmorill wants to merge 4 commits intoshigma:mainfrom
montmorill:main
Open

Adds type safety for schema roles and refines generic signatures#75
montmorill wants to merge 4 commits intoshigma:mainfrom
montmorill:main

Conversation

@montmorill
Copy link
Copy Markdown

Introduces a Roles interface to define valid role strings for each schema type, enforcing type safety when setting the role meta property. Updates the Schema generic to include a Type parameter, allowing the meta.role to be constrained to the specific roles permitted for that schema type. This prevents invalid role assignments and improves developer experience with better IDE autocompletion and error checking.

Introduces a `Roles` interface to define valid role strings for each schema type, enforcing type safety when setting the `role` meta property. Updates the `Schema` generic to include a `Type` parameter, allowing the `meta.role` to be constrained to the specific roles permitted for that schema type. This prevents invalid role assignments and improves developer experience with better IDE autocompletion and error checking.
Corrects inconsistent indentation in commented-out code block to maintain consistent formatting throughout the file.
Standardizes code style by removing extraneous semicolons and fixing indentation
in array iteration and property assignment patterns
The explicit type cast was redundant as TypeScript can infer
the correct return type from the function implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant