Skip to content

TypeScript Error: "Type instantiation is excessively deep and possibly infinite" When Using Certain Property Names #94

@joaohenrique-hs

Description

@joaohenrique-hs

Package version

3.0.0

Describe the bug

TypeScript Error: "Type instantiation is excessively deep and possibly infinite" When Using Certain Property Names

When defining a schema in VineJS, changing a property name from datasheetBase to datasheetBase64 causes TypeScript to throw the following error:

Type instantiation is excessively deep and possibly infinite

This issue appears to be directly related to the property name itself, rather than the schema's nesting or complexity. Other names, such as datasheet64Base or base64Datasheet, trigger this error too.

Steps to Reproduce
✅ The following schema works correctly:

import vine from '@vinejs/vine'

const schema = vine.object({
  datasheetBase: vine.string().optional(),
})

❌ But changing datasheetBase to datasheetBase64 causes a TypeScript error:

const schema = vine.object({
  datasheetBase64: vine.string().optional(),
})

This happens even with a simple string property and does not involve nesting or complex types.

Expected Behavior
VineJS should allow property names like datasheetBase64 without causing excessive type instantiation errors.

Environment
VineJS Version: 3.0.0
TypeScript Version: ~5.7
Node.js Version: 20.13.1
Package Manager: yarn 1.22.22

Additional Notes
This suggests a possible issue in VineJS’s type definitions, where specific property names (e.g., ones ending in numbers like 64) may be causing excessive type expansion. Any insights or fixes would be greatly appreciated!

Thanks for your time! 😊

Reproduction repo

No response

Metadata

Metadata

Assignees

Labels

Type: BugThe issue has indentified a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions