@@ -158,20 +158,23 @@ interface FormatDelegatePrettierOptions {
158158/**
159159 * Supported parsers for the `formatDelegatePrettier` function.
160160 */
161- type FormatDelegatePrettierSupportedParser = keyof Pick <
162- typeof PrettierAngularPlugin . parsers &
163- typeof PrettierBabelPlugin . parsers &
164- typeof PrettierHtmlPlugin . parsers &
165- typeof PrettierPostcssPlugin . parsers ,
166- | 'css'
167- | 'vue'
168- | '__vue_event_binding'
169- | '__vue_expression'
170- | '__js_expression'
171- | '__ng_binding'
172- | '__ng_action'
173- | '__ng_directive'
174- > ;
161+ type FormatDelegatePrettierSupportedParser =
162+ | keyof Pick <
163+ typeof PrettierAngularPlugin . parsers &
164+ typeof PrettierBabelPlugin . parsers &
165+ typeof PrettierHtmlPlugin . parsers &
166+ typeof PrettierPostcssPlugin . parsers ,
167+ | 'css'
168+ | 'vue'
169+ | '__vue_event_binding'
170+ | '__vue_expression'
171+ | '__js_expression'
172+ | '__ng_binding'
173+ | '__ng_action'
174+ | '__ng_directive'
175+ >
176+ | '__vue_ts_event_binding'
177+ | '__vue_ts_expression' ;
175178
176179/**
177180 * The printer class.
@@ -721,13 +724,31 @@ export class PugPrinter {
721724 }
722725
723726 private async formatVueEventBinding ( val : string ) : Promise < string > {
724- return this . formatDelegatePrettier ( val , '__vue_event_binding' , {
727+ try {
728+ return await this . formatDelegatePrettier ( val , '__vue_event_binding' , {
729+ trimTrailingSemicolon : true ,
730+ } ) ;
731+ } catch {
732+ return this . formatVueTsEventBinding ( val ) ;
733+ }
734+ }
735+
736+ private async formatVueTsEventBinding ( val : string ) : Promise < string > {
737+ return this . formatDelegatePrettier ( val , '__vue_ts_event_binding' , {
725738 trimTrailingSemicolon : true ,
726739 } ) ;
727740 }
728741
729742 private async formatVueExpression ( val : string ) : Promise < string > {
730- return this . formatDelegatePrettier ( val , '__vue_expression' ) ;
743+ try {
744+ return await this . formatDelegatePrettier ( val , '__vue_expression' ) ;
745+ } catch {
746+ return this . formatVueTsExpression ( val ) ;
747+ }
748+ }
749+
750+ private async formatVueTsExpression ( val : string ) : Promise < string > {
751+ return this . formatDelegatePrettier ( val , '__vue_ts_expression' ) ;
731752 }
732753
733754 private async formatAngularBinding ( val : string ) : Promise < string > {
0 commit comments