Babel syntax plugin that enables parsing of class properties, private properties, and private methods
94
Create a small module that can parse JavaScript source containing public class fields and return useful information about those fields without transforming the code.
@generates
/**
* Parses JavaScript source and returns an AST that understands public class fields.
* Throws a syntax error for invalid class field syntax.
* @param {string} source - JavaScript code to parse.
* @returns {import('@babel/types').File} Parsed AST.
*/
export function parseWithClassFields(source);
/**
* Returns descriptor objects for every public class field found in the source.
* Parsing must use the same configuration as parseWithClassFields.
* @param {string} source
* @returns {{ className: string, fieldName: string, static: boolean, value: string | null }[]}
*/
export function listPublicFields(source);Allows parsing JavaScript that declares public class fields.
Install with Tessl CLI
npx tessl i tessl/npm-babel--plugin-syntax-class-properties