Skip to content

Commit e91237e

Browse files
committed
docs(workflow-code): the type check in how-it-works and troubleshooting
1 parent 2e88b3c commit e91237e

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎apps/docs/content/docs/workflows/code/how-it-works.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A source file is a declaration, not a program. Sim reads it, compares it with th
99

1010
`workflow.ts` is TypeScript so that your editor can complete and type-check it, but no command executes it. Sim parses the file and reads each `const x = builder('Name', {…})` as one block, each `.to()` as one connection, and each param as one setting. That is why the file holds declarations only: a helper function, a loop that creates blocks, or an import from anything but `@sim/workflow-sdk` has no value Sim could read without running it, so it is refused with `E_UNSUPPORTED_SYNTAX` and a hint.
1111

12-
`check` runs this compiler on your machine, the same one the server runs, against the block catalog the last `get` cached. Function code under `functions/` is not run either: it is stored as the Function block's code and runs in Sim, like code typed into the workflow builder.
12+
`check` runs this compiler on your machine, the same one the server runs, against the block catalog the last `get` cached, then type-checks the directory with the TypeScript release the generated declarations are built for. Function code under `functions/` is not run either: it is stored as the Function block's code and runs in Sim, like code typed into the workflow builder.
1313

1414
## From a file to a saved draft
1515

‎apps/docs/content/docs/workflows/code/troubleshooting.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ The file holds a form Sim cannot read without running it, such as a helper funct
9696

9797
A builder or param name the block catalog does not have. The hint suggests the closest name. `sim workflows source params <builder>` prints a builder's params and outputs, and a namespace such as `gmail` lists its builders.
9898

99+
### `E_TYPE` and `W_TYPES_UNCHECKED` [#e-type]
100+
101+
`E_TYPE` is a type error `check` found after the compile; its message starts with TypeScript's own code, such as `TS2339: Property 'emial' does not exist`. Fix it at the line it names: it usually reads an output or input the block does not declare, or passes a value of the wrong type. `W_TYPES_UNCHECKED` means the type check did not run, most often because the first `check` on this machine could not install TypeScript offline. The compile's findings still stand; run `check` once with network access, or pass `--no-types`.
102+
99103
### `W_REQUIRED_MISSING` [#w-required-missing]
100104

101105
A required field is empty, or holds `todo()`. Fill it in, or use `env.NAME` for a value you keep in an environment variable.

0 commit comments

Comments
 (0)