CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-babel--plugin-syntax-class-properties

Babel syntax plugin that enables parsing of class properties, private properties, and private methods

94

1.04x
Overview
Eval results
Files

task.mdevals/scenario-1/

Private Class Feature Parser

Build a parsing helper that accepts JavaScript source containing private class fields and methods and returns a summary of those members without transforming the code.

Capabilities

Parses private instance members

  • A class declaring a private instance field #count and private method #inc() is parsed without error, returning privateMembers entries for both with static: false and correct kinds. @test

Parses private static members

  • A class declaring static private field #registry and static private method #touch() is parsed without error, returning entries marked static: true for both members. @test

Rejects invalid private usage

  • Referencing #secret outside any class body raises a syntax error that includes the private name in the error message. @test

Implementation

@generates

API

export function parseWithPrivateMembers(
  source: string,
  options?: { filename?: string }
): {
  ast: object;
  privateMembers: Array<{ name: string; kind: 'field' | 'method'; static: boolean }>;
};

Dependencies { .dependencies }

@babel/core { .dependency }

Parses JavaScript into an AST using configurable syntax plugins.

@satisfied-by

@babel/plugin-syntax-class-properties { .dependency }

Enables parsing of inline class fields, including private ones, without emitting transformations.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-babel--plugin-syntax-class-properties

tile.json