|
6 | 6 | import cz.habarta.typescript.generator.TsType; |
7 | 7 | import cz.habarta.typescript.generator.TsType.BasicArrayType; |
8 | 8 | import cz.habarta.typescript.generator.TsType.FunctionType; |
| 9 | +import cz.habarta.typescript.generator.TsType.GenericBasicType; |
9 | 10 | import cz.habarta.typescript.generator.TsType.GenericReferenceType; |
10 | 11 | import cz.habarta.typescript.generator.TsType.IndexedArrayType; |
11 | 12 | import cz.habarta.typescript.generator.TsType.IntersectionType; |
@@ -35,6 +36,10 @@ public DirectoryEmitter(Settings settings) { |
35 | 36 | super(settings); |
36 | 37 | } |
37 | 38 |
|
| 39 | + public Output getOutput() { |
| 40 | + return output; |
| 41 | + } |
| 42 | + |
38 | 43 | @Override |
39 | 44 | public void emit(TsModel model, Writer output, String outputName, boolean closeOutput, boolean forceExportKeyword, int initialIndentationLevel) { |
40 | 45 | initSettings(output, forceExportKeyword, initialIndentationLevel); |
@@ -150,6 +155,7 @@ private void emitDirectoryExtensions(TsModel model, TsDeclarationModel declarati |
150 | 155 | for (EmitterExtension emitterExtension : settings.extensions) { |
151 | 156 | if (emitterExtension instanceof DirectoryEmitterExtension) { |
152 | 157 | DirectoryEmitterExtension directoryEmitter = (DirectoryEmitterExtension) emitterExtension; |
| 158 | + directoryEmitter.setOutput(output); |
153 | 159 |
|
154 | 160 | final List<String> extensionLines = new ArrayList<>(); |
155 | 161 | final EmitterExtension.Writer extensionWriter = line -> extensionLines.add(line); |
@@ -190,12 +196,11 @@ private void collectType(Set<TsType> list, TsType type) { |
190 | 196 | collectType(list, ((OptionalType) type).type); |
191 | 197 | } else if (type instanceof FunctionType) { |
192 | 198 | collectType(list, ((FunctionType) type).type); |
| 199 | + } else if (type instanceof GenericBasicType) { |
| 200 | + collectTypes(list, ((GenericBasicType) type).typeArguments); |
193 | 201 | } else if (type instanceof GenericReferenceType) { |
194 | 202 | list.add(type); |
195 | | - List<TsType> typeArguments = ((GenericReferenceType) type).typeArguments; |
196 | | - for (TsType tsType : typeArguments) { |
197 | | - collectType(list, tsType); |
198 | | - } |
| 203 | + collectTypes(list, ((GenericReferenceType) type).typeArguments); |
199 | 204 | } else if (type instanceof UnionType) { |
200 | 205 | List<TsType> types2 = ((UnionType) type).types; |
201 | 206 | for (TsType tsType2 : types2) { |
|
0 commit comments