rescript-schema icon indicating copy to clipboard operation
rescript-schema copied to clipboard

Empty object not accepted by @schema

Open alelaru opened this issue 7 months ago • 2 comments

"rescript-schema": "9.3.0"

I tried to add an empty object for a type variable but it won't work when trying to create the schema automatically

@schema
type variableName = {}

Error: [{ "resource": "xxxx", "owner": "generated_diagnostic_collection_name#0", "severity": 8, "message": "Empty record literal {} should be type annotated or used in a record context.", "source": "ReScript", "startLineNumber": 1, "startColumn": 1, "endLineNumber": 1, "endColumn": 1 }]

I had to do this to make it work

let variableNameSchema = S.object((_): variableName => {})

Issue found in version v9 and v10

alelaru avatar Jun 24 '25 08:06 alelaru