Effect CommunityEC
Effect Community16mo ago
3 replies
nikgraf

Clarifying Type Definition Methods in Schema Usage

Just stumbled upon this in the getting started:

type Person = Schema.Schema.Type<typeof Person>
/*
Equivalent to:
type Person = {
  readonly name: string;
  readonly age: number;
}
*/
 
// 2. Using the `Type` field
type Person2 = typeof Person.Type


Is there any benefit between these two or any reason to use one over the other? If not I'm happy to contribute a PR changing the example and mention that these two are equivalent and put a recommendation which one to use.
Was this page helpful?