Skip to content

Commit

Permalink
fix(core/generate): fixes typings
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Oct 18, 2019
1 parent 3fa7bdd commit 79196ca
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions packages/core/src/generate/typings.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import fs from 'fs';
import { CollectionTree } from '~/types';
import { compile } from 'json-schema-to-typescript';
import camelcase from 'camelcase';
import { normalize } from '~/transform';
import { normalize } from '~/transform/normalize';

export interface TypingsGenerateOptions {
/**
Expand All @@ -17,19 +16,17 @@ export async function typings(
): Promise<string> {
const opts = { write: null, ...options };

let content =
let content = '';

content +=
'/* eslint-disable */\n' +
'/* tslint:disable */\n' +
'/* This file was automatically generated. DO NOT MODIFY IT BY HAND. */\n\n';

const { types } = normalize(collection);
for (const [key, value] of Object.entries(types)) {
if (value.kind !== 'error') {
content += await compile(
value.schema,
camelcase(key, { pascalCase: true }),
{ bannerComment: '' }
);
content += await compile(value.schema, key, { bannerComment: '' });
content += '\n';
}
}
Expand Down

0 comments on commit 79196ca

Please sign in to comment.