oven-sh/bun · error · Error
t.${type.kind} can only be used as a function argument type
Error message
t.${type.kind} can only be used as a function argument type What it means
Error "t.${type.kind} can only be used as a function argument type" thrown in oven-sh/bun.
Source
Thrown at src/codegen/bindgen-lib-internal.ts:669
}
export function inspect(value: any) {
return Bun.inspect(value, { colors: Bun.enableANSIColors });
}
export function oneOfImpl(types: TypeImpl[]): TypeImpl {
const out: TypeImpl[] = [];
for (const type of types) {
if (type.kind === "oneOf") {
out.push(...type.data);
} else {
if (type.flags.default) {
throw new Error(
"Union type cannot include a default value. Instead, set a default value on the union type itself",
);
}
if (type.isVirtualArgument()) {
throw new Error(`t.${type.kind} can only be used as a function argument type`);
}
out.push(type);
}
}
return new TypeImpl("oneOf", out);
}
export function dictionaryImpl(record: Record<string, TypeImpl>): TypeImpl {
const out: DictionaryField[] = [];
for (const key in record) {
const type = record[key];
if (type.isVirtualArgument()) {
throw new Error(`t.${type.kind} can only be used as a function argument type`);
}
out.push({
key,
type: type,
});View on GitHub (pinned to 8c5296ac45)
When it happens
Trigger: Thrown at src/codegen/bindgen-lib-internal.ts:669 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/b746e914b7b26891.
Report an issue: GitHub.