cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.58k stars 665 forks source link

🐛 BUG: want to output only types by wrangler types #5668

Closed ryoppippi closed 5 months ago

ryoppippi commented 5 months ago

Which Cloudflare product(s) does this pertain to?

Wrangler core

What version(s) of the tool(s) are you using?

⛅️ wrangler 3.51.2

What version of Node are you using?

bun

What operating system and version are you using?

Sonoma 14.4.1

Describe the Bug

wrangler.toml

name = "my-app"
compatibility_date = "2023-12-01"

[vars]
MY_VAR = "my-variable"

[[kv_namespaces]]
binding = "MY_KV_NAMESPACE"
id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

[[r2_buckets]]
binding = "MY_BUCKET"
bucket_name = "my-bucket"

[[d1_databases]]
binding = "DB"
database_name = "my-database"
database_id = ""

[ai]
binding = "AI"

then

bun wrangler types > types.ts

And the result is types.ts

 ⛅️ wrangler 3.51.2
-------------------
interface Env {
    MY_KV_NAMESPACE: KVNamespace;
    MY_VAR: "my-variable";
    MY_BUCKET: R2Bucket;
    DB: D1Database;
    AI: unknown;
}

I'd like to output only interface Env. Is there any options for deleting the first two lines of message?

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

ryoppippi commented 5 months ago

Oh got it When I run the command like

bun wrangler types.d.ts

It works!