Comments (4)
It raises an error because the Schema.Class
API implicitly defines a transformation, specifically from:
Schema.Struct({
id: Schema.Number,
title: Schema.String,
completed: Schema.Boolean
})
to Todo
in this case, and transformations are not supported by Schema.partial
.
However, this should work:
const UpdateTodoParams = Schema.partial(Schema.Struct(Todo.fields), { exact: true })
from effect.
Got it. Thank you for your reply.
Tried your solution and that stopped the error from occurring. However, I was expecting the non-unionised type, since exact: true
is passed as an option to opt out of unionisation. However, types are still unionised. Am I missing something here?
![image](https://private-user-images.githubusercontent.com/79074469/344257261-784c88da-990e-4650-9192-54e7e65c6eb3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIyOTI2MjAsIm5iZiI6MTcyMjI5MjMyMCwicGF0aCI6Ii83OTA3NDQ2OS8zNDQyNTcyNjEtNzg0Yzg4ZGEtOTkwZS00NjUwLTkxOTItNTRlN2U2NWM2ZWIzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI5VDIyMzIwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFiZTVhOGI3ZDAzY2Q2YWEzNGYyYTJhMTc2MmNiOWE3YTIyMmMzYmE4MzM2NzliZjJkYzE1MzIwMzM5ZGUyZWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.EYtqEiCha_p63bhoDVZioUJ04C6Bcybdw9bTZ8E_sUA)
from effect.
Do you have the exactOptionalPropertyTypes
option enabled in your tsconfig?
from effect.
Yep that was the missing piece. Sorry, I overlooked the documentation here.
Thanks you very much for this really powerful and composable library.
from effect.
Related Issues (20)
- Move type helpers from nested namespace to the top-level namespace HOT 4
- From Discord: decode error which should be caught at compile time
- From Discord: Resolving Kysely Integration Issues in Effect with SqlResolver HOT 1
- Generate Mermaid class diagram (or expose DAG) from schema HOT 7
- From Discord: Limitations of `S.TemplateLiteral` Schema Support and the Case for Broader Transform Compatibility
- RuntimeException: Cannot execute an Effect versioned 3.5.6 with a Runtime of version 3.4.7 HOT 4
- docs: no docs for filter() and filterMap() HOT 5
- Re-evaluate filtering functions HOT 4
- Make HttpClient compatible with Browser HOT 2
- From Discord: Confusion with Prompt.all: Handling Record/Struct Arguments in TypeScript
- From Discord: Lurking in TaggedRequest of `@effect/schema`
- From Discord: OptionFromNonEmptyTrimmedString
- Schema.Trim result in a Parsing Error when using Schema.Class and Schema.TaggedClass with "new" and "make" constructors HOT 1
- `Prompt.text()` fails to receive text pasted from clipboard HOT 1
- From Discord: Making Readonly Array Mutable for schemaSearchParams in HttpServerRequest
- Default Random service not uniquely seeded
- From Discord: Retrieving Annotations from TypeScript Classes
- From Discord: Understanding the Absence of `Context` in `TypeLiteral` Components
- Effect SQL Turso Adapter HOT 1
- RFC: Retaining Struct Schema with Transformations in `Schema.typeSchema` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from effect.