Skip to content

static: an object-literal key named arguments inside an arrow function is read as the arguments object (SC2009) #431

Closed

Description

@temich

Summary

Inside an arrow function, an object-literal property named arguments is treated as a read of the arguments object. The function is then refused as variadic (SC2009). Node's own APIs have this shape: node-redis takes { keys, arguments } in eval/evalSha.

Reproduction

const make = (): { arguments: number } => ({ arguments: 1 })
console.log(make().arguments)
$ node a.ts
1
$ scriptc run a.ts
a.ts:1:7 - error SC2009: values of type '() => { arguments: number; }' cannot be compiled: the function shape is supported, but its signature is variadic ('arguments'-reading), and a compiled signature is fixed-arity

The same body in a function declaration compiles. So does a property access such as o.arguments.

A more realistic form:

interface Options { keys: string[]; arguments: string[] }
const count = (options: Options): number => options.keys.length + options.arguments.length
const later = (): number => count({ keys: ['a'], arguments: ['b', 'c'] })
console.log(later()) // Node: 3; scriptc: SC2009 on `later`

Cause

bodyReadsArguments (frontend/lowering/lower-calls.ts) and its copy bodyReadsArgumentsLocal (frontend/type-mapper.ts) count every Identifier whose text is arguments, except the name of a property access. A property-assignment name in an object literal is also an Identifier, so it counts. So would a property signature in an inline type, a destructuring property name (const { arguments: a } = o) or a method name.

Writing the key as ['arguments'] avoids it.

Environment

scriptc 0.1.4, Ubuntu 26.04 x86_64, Node 24.21.0.

Activity

  1. added a commit that references this issue on Sep 25, 2026
    cf1fb1c
  2. added a commit that references this issue on Sep 26, 2026
    05a36fa
  3. added a commit that references this issue on Sep 26, 2026
    c1634d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions