-
Notifications
You must be signed in to change notification settings - Fork 389
Closed
cloudflare/cloudflare-docs
#28493Description
Summary
Codemode public docs claim Typescript is supported. However, attempts to execute TS seem to fail due to TS-specific syntax errors.
Workaround
Prompting to only use Javascript is successful.
To Reproduce
- Create an AI Agent using the Agents SDK and give it the codemode tool
- Give a specific prompt asking to execute Typescript
- Observe codemode syntax errors
Example
execute a basic Typescript function and show me any errors
✗ code: code
✗ code: code
I attempted to execute a TypeScript function, but it appears the code execution environment doesn't support TypeScript syntax (it likely only runs JavaScript). Here's what happened and what I can show you instead:
The error you'll see with TypeScript code execution:
SyntaxError: Unexpected token ':'
Here's a JavaScript equivalent that would work:
function add(a, b) {
return a + b;
}
function greet(name) {
return `Hello, ${name}!`;
}
// This line would cause an error if we had TypeScript type checking
const greeting = greet(123); // We'd get a type mismatch warning in TypeScript
// Works fine
const sum = add(5, 3);
console.log(sum); // Output: 8Versions
| Package | Specifier | Installed |
|---|---|---|
@cloudflare/ai-chat |
latest |
0.1.3 |
@cloudflare/codemode |
0.1.0 |
0.1.0 |
agents |
latest |
0.5.1 |
Context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels