Error ts(2345) ― Argument of type '{ providers: Layer.Layer<never, never, never>; }' is not assignable to parameter of type 'StackProps<never>'.
Property 'state' is missing in type '{ providers: Layer.Layer<never, never, never>; }' but required in type 'StackProps<never>'.
Provides a way to write effectful code using generator functions, simplifying
control flow and error handling.
When to Use
gen allows you to write code that looks and behaves like synchronous
code, but it can handle asynchronous tasks, errors, and complex control flow
(like loops and conditions). It helps make asynchronous code more readable
and easier to manage.
The generator functions work similarly to async/await but with more
explicit control over the execution of effects. You can yield* values from
effects and return the final result at the end.
TypeScript is unhappy: the state property is required. Every Stack
needs a state store so Alchemy can persist resource state between
deploys and compute diffs against your infrastructure.
Provides a way to write effectful code using generator functions, simplifying
control flow and error handling.
When to Use
gen allows you to write code that looks and behaves like synchronous
code, but it can handle asynchronous tasks, errors, and complex control flow
(like loops and conditions). It helps make asynchronous code more readable
and easier to manage.
The generator functions work similarly to async/await but with more
explicit control over the execution of effects. You can yield* values from
effects and return the final result at the end.
The first time you run alchemy deploy, plan, or dev, Alchemy
will prompt for permission and bootstrap the state-store Worker into
your Cloudflare account. It looks like this:
~/my-appDEPLOY
$
This is a one-time event — the state-store Worker, its Durable
Object, and the Secrets Store entries holding its auth token and
encryption key are reused across every stack and stage on this
Cloudflare account. See State Store for
the full picture.
Resources represent cloud infrastructure — buckets, queues, functions,
databases, and so on. Each resource is yield*-ed inside the Stack’s
Effect generator.
Let’s add a Cloudflare R2 Bucket to our Stack and observe the type error:
This layer provides no services and can be used as a neutral element
in layer composition or as a starting point for building layers.
@example
import { Layer } from"effect"
constemptyLayer=Layer.empty
@since ― 2.0.0
@category ― constructors
empty,
Error ts(2322) ― Type 'Layer<never, never, never>' is not assignable to type 'Layer<NoInfer<Providers>, never, StackServices>'.
Type 'Providers' is not assignable to type 'never'.
Provides a way to write effectful code using generator functions, simplifying
control flow and error handling.
When to Use
gen allows you to write code that looks and behaves like synchronous
code, but it can handle asynchronous tasks, errors, and complex control flow
(like loops and conditions). It helps make asynchronous code more readable
and easier to manage.
The generator functions work similarly to async/await but with more
explicit control over the execution of effects. You can yield* values from
effects and return the final result at the end.
Provides a way to write effectful code using generator functions, simplifying
control flow and error handling.
When to Use
gen allows you to write code that looks and behaves like synchronous
code, but it can handle asynchronous tasks, errors, and complex control flow
(like loops and conditions). It helps make asynchronous code more readable
and easier to manage.
The generator functions work similarly to async/await but with more
explicit control over the execution of effects. You can yield* values from
effects and return the final result at the end.
Now the program type-checks. The providers layer tells Alchemy how to
talk to Cloudflare’s APIs, and the type system ensures you never
forget to wire it up.
Provides a way to write effectful code using generator functions, simplifying
control flow and error handling.
When to Use
gen allows you to write code that looks and behaves like synchronous
code, but it can handle asynchronous tasks, errors, and complex control flow
(like loops and conditions). It helps make asynchronous code more readable
and easier to manage.
The generator functions work similarly to async/await but with more
explicit control over the execution of effects. You can yield* values from
effects and return the final result at the end.
The first time you deploy, Alchemy walks each provider in your stack
through an interactive login and saves the credentials to your
defaultprofile at
~/.alchemy/profiles.json. For Cloudflare you can sign in with
OAuth in the browser or paste an API token — no environment
variables or wrangler login required.
Plan: 1 to create+Bucket(Cloudflare.R2Bucket)
Proceed?
◉ Yes ○ No
✓Bucket(Cloudflare.R2Bucket)created
{
bucketName: "myapp-bucket-a1b2c3d4e5",
}
Alchemy shows a plan, asks for confirmation, creates the resource,
and prints the stack outputs. Your bucket is live on Cloudflare.