how to filter out source files without declarations during emission? #4702
-
Hello, my use case is to generate file by namespace. I I only want to write non-empty source files. I could access the asset emitter after the emission but only to get information about source files and their declarations in globalscope, I don't know what I can do to filter these out before calling Or perhaps I was not following the correct control flow in creating source file in the first place? Other than the empty files for empty namespaces, the generated files are OK. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I asume you are talking about the emitter framework, if you registered your declarations on the right scope you should be able to get all declarations added to a file and decide if you want to emit it or not. Side note: emitter framework in its current state as a lot of issues and is not ideal, we are working on a completely different approach to help emitter authors |
Beta Was this translation helpful? Give feedback.
I asume you are talking about the emitter framework, if you registered your declarations on the right scope you should be able to get all declarations added to a file and decide if you want to emit it or not.
typespec/packages/json-schema/src/json-schema-emitter.ts
Line 720 in ff1725c
Side note: emitter framework in its current state as a lot of issues and is not ideal, we are working on a completely different approach to help emitter authors