Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update effect deps #840

Merged
merged 9 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions content/docs/400-guides/800-schema/200-basic-usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1621,34 +1621,35 @@ console.log(Schema.decodeUnknownSync(Person)({ name: "name", AGE: "18" }))
When defining types in TypeScript that include optional fields with the type `never`, such as:

```ts
type A = {
readonly a?: never
type MyType = {
readonly foo?: never
}
```

the approach varies based on the `exactOptionalPropertyTypes` configuration in your `tsconfig.json`

**TypeScript Configuration: `exactOptionalPropertyTypes = false`**

When this setting is disabled, optional fields are best handled by explicitly defining them as `undefined`. This reflects that the field may not be present, and if it is, it holds no value.
When this feature is turned off, you can employ the `Schema.optional` function. This approach allows the field to implicitly accept `undefined` as a value.

```ts twoslash
import { Schema } from "@effect/schema"

const schema = Schema.Struct({
a: Schema.optional(Schema.Undefined)
foo: Schema.optional(Schema.Never)
})
```

**TypeScript Configuration: `exactOptionalPropertyTypes = true`**

With `exactOptionalPropertyTypes` enabled, the definition changes slightly to enforce the field's absence more strictly. This configuration is more precise and aligns with newer TypeScript strictness features.
When this feature is turned on, the `Schema.optionalWith` function is recommended.
It ensures stricter enforcement of the field's absence.

```ts twoslash
import { Schema } from "@effect/schema"

const schema = Schema.Struct({
a: Schema.optionalWith(Schema.Never, { exact: true })
foo: Schema.optionalWith(Schema.Never, { exact: true })
})
```

Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"packageManager": "[email protected]",
"dependencies": {
"@dprint/formatter": "^0.3.0",
"@effect-rx/rx-react": "^0.30.13",
"@effect/experimental": "^0.25.1",
"@effect/platform": "^0.64.0",
"@effect/platform-browser": "^0.43.0",
"@effect/rpc": "^0.38.0",
"@effect/rpc-http": "^0.36.0",
"@effect/schema": "^0.72.3",
"@effect-rx/rx-react": "^0.31.0",
"@effect/experimental": "^0.26.1",
"@effect/platform": "^0.65.1",
"@effect/platform-browser": "^0.44.1",
"@effect/rpc": "^0.39.1",
"@effect/rpc-http": "^0.37.1",
"@effect/schema": "^0.73.0",
"@headlessui/react": "1.7.17",
"@radix-ui/react-accordion": "^1.2.0",
"@radix-ui/react-alert-dialog": "^1.1.1",
Expand All @@ -48,12 +48,12 @@
"cmdk": "^1.0.0",
"date-fns": "^3.6.0",
"dotenv": "^16.3.1",
"effect": "^3.7.2",
"effect": "^3.8.0",
"emulate-tab": "^1.2.1",
"framer-motion": "^11.3.21",
"github-slugger": "^2.0.0",
"highlight.js": "^11.10.0",
"next": "14.2.5",
"next": "14.2.11",
"next-contentlayer": "^0.3.4",
"next-themes": "^0.3.0",
"react": "^18.3.1",
Expand All @@ -68,9 +68,9 @@
"tailwind-merge": "^2.3.0"
},
"devDependencies": {
"@effect/opentelemetry": "^0.36.2",
"@effect/platform-node": "^0.59.0",
"@effect/platform-bun": "^0.44.0",
"@effect/opentelemetry": "^0.37.0",
"@effect/platform-node": "^0.60.1",
"@effect/platform-bun": "^0.45.1",
"@mermaid-js/mermaid-cli": "^10.8.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.51.1",
"@opentelemetry/sdk-trace-base": "^1.24.1",
Expand Down Expand Up @@ -99,7 +99,7 @@
"tailwindcss": "^3.4.4",
"tailwindcss-animate": "^1.0.7",
"tsx": "^4.16.2",
"typescript": "5.5.4",
"typescript": "5.6.2",
"vercel": "^34.2.0"
}
}
Loading