A strict-typed prop builder for Vue 2 components, enabling compile-time type safety for component props using TypeScript. Version 0.3.6, last updated in 2019, and is no longer actively developed. Provides a chainable API to define required, optional, and default props with validators, supporting arrays of types, string literals, and custom types. Differentiates from Vue's native prop options by offering static type inference for component instances without relying on PropType or manual type annotations. Requires Vue 2.x and TypeScript ≥2.9.1.
npm install vue-strict-propVerified import paths — ran on the pinned version, not inferred.
Defines a Vue component with strict-typed props using vue-strict-prop, including required, default, and array props, then mounts it.
Migrate to Vue 3 with defineComponent and PropType, or use TypeScript's built-in prop inference with Vue.extend.
Always chain default before required/optional: p(T).default(val).required instead of p(T).required.default(val).
Ensure passed values match intended literal strings: p.ofStringLiterals('black', 'blue', 'red').Use explicit type assertion: p.ofType<SomeType>() as Prop<SomeType> if needed, or define prop with default value to enforce validation.
Add nullish check: `if (this.prop) { ... }` or use `.required` if the prop is mandatory.Ensure validator is called after specifying the type: p(String).validator(v => ...).required
Run npm install vue-strict-prop and ensure TypeScript's moduleResolution is set to 'node' and esModuleInterop is enabled.
Remove the explicit type if default is provided: p(String).default('hello') instead of p(String).default<string>('hello').