Skip to content

TS: static arrow-function class properties are unresolvable as Class > member #166

Description

@Connorrmcd6

Symptom

Anchoring a TypeScript static class property whose value is an arrow function fails to resolve:

error: hubs/staking.md :: packages/shared-resources/src/utils/NansenPointsTiers.ts > NansenPointsTiersUtils > getTierStakingBalanceRequirement
    `getTierStakingBalanceRequirement` not found (claim has no stored hash to match against)

Repro (minimal)

export class Utils {
  static works(x: number): number {        // resolves: Utils > works
    return x
  }
  static fails = (x: number): number => {  // "not found": Utils > fails
    return x
  }
}

file.ts > Utils > works resolves; file.ts > Utils > fails errors. surf suggest on a file whose class members are all arrow properties reports "no unanchored public symbols found", so the members are invisible to suggest too.

Real-world hit

Dogfooding on the superapp monorepo (surf 0.8.0), writing a staking hub:

  • packages/shared-resources/src/utils/StakeUtils.ts > StakeUtils > parsestatic parse(...) {} method syntax → resolves fine.
  • packages/shared-resources/src/utils/NansenPointsTiers.ts > NansenPointsTiersUtils > getTierStakingBalanceRequirementstatic getTierStakingBalanceRequirement = (tier) => {...} property syntax → unresolvable.

Same class shape, same call sites, only the declaration syntax differs. The static-arrow-property style is common in TS codebases (it's what Biome/TS class-property idiom produces), so hub authors will hit this on exactly the utility classes they most want to anchor.

Prior art

Workaround

Anchor the whole class (file.ts > NansenPointsTiersUtils) — works but over-scopes the span, so any edit to unrelated members re-triggers verification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions