Skip to content

fix #10812: Update compiler module types to include optional modifiers #10743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions flow/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ declare type CompiledResult = {
declare type ModuleOptions = {
// transform an AST node before any attributes are processed
// returning an ASTElement from pre/transforms replaces the element
preTransformNode: (el: ASTElement) => ?ASTElement;
preTransformNode?: (el: ASTElement) => ?ASTElement;
// transform an AST node after built-ins like v-if, v-for are processed
transformNode: (el: ASTElement) => ?ASTElement;
transformNode?: (el: ASTElement) => ?ASTElement;
// transform an AST node after its children have been processed
// cannot return replacement in postTransform because tree is already finalized
postTransformNode: (el: ASTElement) => void;
genData: (el: ASTElement) => string; // generate extra data string for an element
postTransformNode?: (el: ASTElement) => void;
genData?: (el: ASTElement) => string; // generate extra data string for an element
transformCode?: (el: ASTElement, code: string) => string; // further transform generated code for an element
staticKeys?: Array<string>; // AST properties to be considered static
};
Expand Down
8 changes: 4 additions & 4 deletions packages/vue-template-compiler/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ interface CompiledResultFunctions {
}

interface ModuleOptions {
preTransformNode: (el: ASTElement) => ASTElement | undefined;
transformNode: (el: ASTElement) => ASTElement | undefined;
postTransformNode: (el: ASTElement) => void;
genData: (el: ASTElement) => string;
preTransformNode?: (el: ASTElement) => ASTElement | undefined;
transformNode?: (el: ASTElement) => ASTElement | undefined;
postTransformNode?: (el: ASTElement) => void;
genData?: (el: ASTElement) => string;
transformCode?: (el: ASTElement, code: string) => string;
staticKeys?: string[];
}
Expand Down