BugDomain: APIHelp Wanted
説明
Related to #25220
There are quite a few inconsistencies among the factory functions:
- naming: sometimes the name doesn't really describe what it does.
createStatementinstead ofcreateExpressionStatement: what statement does it create?createBinary: maybe binary number literal?createParen:ParenthesizedExpressionorParenthesizedType?createSpread:SpreadElementorSpreadAssignment?createThrow: becomes ambiguous once the ThrowExpression proposal advances to stage 4createDo: becomes ambiguous once the DoExpression proposal advances to stage 4- Should all of the factory function names match the name of the Node exactly? If so, should they be renamed while keeping a deprecated alias around for backwards compatibility (like #25348)?
- nullable parameters:
createTypeLiteralallows themembersparameter to beundefinedcreateInterfaceDeclarationon the other hand requires an array asmembersparameter
- overload signatures to avoid creating invalid nodes:
createYieldhas overloads for that purposecreateImportClauseorcreateExportDeclarationfor example allow all parameters to beundefined, resulting in an invalid node
- optional parameters:
objectAssignmentInitializerincreateShorthandPropertyAssignmentis optionaltypeArgumentsincreateTypeReferenceNodeis required although it's nullable
decorators- e.g.
createConstructororcreateExportAssignmentrequire adecoratorsparameter although it's an error to have decorators on those nodes
- e.g.
modifiers- e.g.
createExportAssignmentrequires amodifiersparameter although this node cannot have any modifiers (not evendeclare)
- e.g.