class ServiceEmitter {

    public void emitTypescriptTypes(TypescriptServiceGeneratorConfiguration settings, List<Type> additionalTypesToOutput) {
        Settings settingsToUse = settings.getSettings();
        TypeProcessor baseTypeProcessor = settingsToUse.customTypeProcessor;

        Set<Type> referencedTypes = Sets.newHashSet(model.referencedTypes().iterator());
        referencedTypes.addAll(additionalTypesToOutput);
        Set<Class<?>> referencedClasses = getReferencedClasses(referencedTypes, settings);
        final Set<Type> discoveredTypes = Sets.newHashSet(referencedClasses.iterator());
        referencedClasses = filterInputClasses(referencedClasses);
        TypeProcessor discoveringProcessor = new TypeProcessor() {
            @Override
            public Result processType(Type javaType, Context context) {
                discoveredTypes.add(javaType);
                return null;
            }
        };

        settingsToUse.customTypeProcessor = discoveringProcessor;
        if (baseTypeProcessor != null) {
            settingsToUse.customTypeProcessor = new TypeProcessor.Chain(discoveringProcessor, baseTypeProcessor);
        }

        TypeScriptGenerator typescriptGenerator = new TypeScriptGenerator(settingsToUse);
        ByteArrayOutputStream typeDeclarations = new ByteArrayOutputStream();
        Type[] types = new Type[referencedClasses.size()];
        referencedClasses.toArray(types);
        int intendationLevel = 1;
        if (!settings.typescriptModule().isPresent()) {
        	intendationLevel = 0;
        }
        typescriptGenerator.generateEmbeddableTypeScript(Input.from(types), Output.to(typeDeclarations), true, intendationLevel);
        writer.write(new String(typeDeclarations.toByteArray()));
    }

    public  ServiceEmitter(ServiceModel model, TypescriptServiceGeneratorConfiguration settings, IndentedOutputWriter writer);

}