fix TS errors
This commit is contained in:
parent
351f1585b7
commit
2fc8ad9539
@ -38,7 +38,7 @@ interface Options {
|
|||||||
name: string;
|
name: string;
|
||||||
feature: number;
|
feature: number;
|
||||||
loose?: boolean;
|
loose?: boolean;
|
||||||
inherits?: () => Options;
|
inherits?: (api: any, options: any) => any;
|
||||||
// same as PluginObject.manipulateOptions
|
// same as PluginObject.manipulateOptions
|
||||||
manipulateOptions: (options: unknown, parserOpts: ParserOptions) => void;
|
manipulateOptions: (options: unknown, parserOpts: ParserOptions) => void;
|
||||||
// TODO(flow->ts): change to babel api
|
// TODO(flow->ts): change to babel api
|
||||||
@ -52,6 +52,7 @@ export function createClassFeaturePlugin({
|
|||||||
manipulateOptions,
|
manipulateOptions,
|
||||||
// TODO(Babel 8): Remove the default value
|
// TODO(Babel 8): Remove the default value
|
||||||
api = { assumption: () => void 0 },
|
api = { assumption: () => void 0 },
|
||||||
|
inherits,
|
||||||
}: Options) {
|
}: Options) {
|
||||||
const setPublicClassFields = api.assumption("setPublicClassFields");
|
const setPublicClassFields = api.assumption("setPublicClassFields");
|
||||||
const privateFieldsAsProperties = api.assumption("privateFieldsAsProperties");
|
const privateFieldsAsProperties = api.assumption("privateFieldsAsProperties");
|
||||||
@ -86,6 +87,7 @@ export function createClassFeaturePlugin({
|
|||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
manipulateOptions,
|
manipulateOptions,
|
||||||
|
inherits,
|
||||||
|
|
||||||
pre() {
|
pre() {
|
||||||
enableFeature(this.file, feature, loose);
|
enableFeature(this.file, feature, loose);
|
||||||
|
|||||||
@ -26,18 +26,17 @@ export default declare((api, options) => {
|
|||||||
} else if (version === "2021-12") {
|
} else if (version === "2021-12") {
|
||||||
return transformer2021_12(api, options);
|
return transformer2021_12(api, options);
|
||||||
} else {
|
} else {
|
||||||
const plugin = createClassFeaturePlugin({
|
return createClassFeaturePlugin({
|
||||||
name: "proposal-decorators",
|
name: "proposal-decorators",
|
||||||
|
|
||||||
api,
|
api,
|
||||||
feature: FEATURES.decorators,
|
feature: FEATURES.decorators,
|
||||||
|
inherits: syntaxDecorators,
|
||||||
// loose: options.loose, Not supported
|
// loose: options.loose, Not supported
|
||||||
|
|
||||||
manipulateOptions({ generatorOpts }) {
|
manipulateOptions({ generatorOpts }) {
|
||||||
generatorOpts.decoratorsBeforeExport = decoratorsBeforeExport;
|
generatorOpts.decoratorsBeforeExport = decoratorsBeforeExport;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
plugin.inherits = syntaxDecorators;
|
|
||||||
return plugin;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user