DWQA QuestionsCategory: ProgramThe typescript decorator reported an error. Why can't the decorator of TS be assigned or exported?
CainKane asked 1 month ago

image.png
image.png
Pay attention to the error reported here
If the syntax is changed to decorator + class declaration, the error will disappear, which is inconsistent with the syntax behavior in ECMAScript
image.png
How to do itexport const Compo = @decorator class {}And through the TS type inspection and guidance
image.png
(I don’t want to write
@decor class App {};
export {App as Compo}
Code like this
)

jokester replied 1 month ago

What is the type of decor

jokester replied 1 month ago

@jokesterIt’s the classdecorator type

1 Answers
CainKane answered 1 month ago

I already know that the syntax of decorator in TS is like this
image.png