Babel syntax plugin that enables parsing of class properties, private properties, and private methods
94
Build a Babel helper that guarantees code containing public and private class fields can be parsed while leaving the emitted code unchanged when class field syntax is already supported elsewhere in the config.
@generates
/**
* Returns a Babel config that guarantees class field syntax is parseable.
* Behaves as a no-op when class field syntax is already enabled.
* @param {import('@babel/core').TransformOptions} baseConfig
* @returns {import('@babel/core').TransformOptions}
*/
export function ensureClassFieldSyntax(baseConfig);
/**
* Transforms source using the safeguarded config and returns the resulting code string.
* @param {string} source
* @param {import('@babel/core').TransformOptions} baseConfig
* @returns {Promise<string>}
*/
export async function transformWithClassFields(source, baseConfig);Runs code transforms with the safeguarded configuration.
Enables parsing for class fields and should act as a no-op when that syntax is already enabled.
Install with Tessl CLI
npx tessl i tessl/npm-babel--plugin-syntax-class-properties