effect icon indicating copy to clipboard operation
effect copied to clipboard

Parameters of `Schema.Record` differ from the other Key-Value types

Open nspaeth opened this issue 1 year ago • 0 comments

What version of Effect is running?

3.2.1

What steps can reproduce the bug?

import * as Schema from '@effect/schema/Schema'
const MyRecord = Schema.Record(Schema.String, Schema.Number)

const MyMap = Schema.Map({key: S.String, value: Schema.Number})
const MyHashMap = Schema.HashMap({key: S.String, value: Schema.Number})
const MyStructMap = Schema.Struct({}, {key: S.String, value: Schema.Number})

What is the expected behavior?

I would expect these constructors to either all accept positional arguments, or all accept object arguments in order to be consistent:

const MyRecord = Schema.Record({ key: Schema.String, value: Schema.Number })

or:

const MyMap = Schema.Map(S.String, Schema.Number)
const MyHashMap = Schema.HashMap(S.String, Schema.Number)
const MyStructMap = Schema.Struct({},  S.String, Schema.Number)

What do you see instead?

No response

Additional information

See Discord Discussion

nspaeth avatar May 21 '24 08:05 nspaeth