Skip to content

Commit

Permalink
fix(types): improve and test bundleRenderer.renderToString Promise types
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Nov 21, 2017
1 parent 3554eb2 commit fcc1229
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vue-server-renderer/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface Renderer {
interface BundleRenderer {
renderToString(callback: RenderCallback): void;
renderToString(context: object, callback: RenderCallback): void;
renderToString(): Promise<string>;
renderToString(context: object): Promise<string>;

renderToStream(context?: object): Readable;
Expand Down
8 changes: 8 additions & 0 deletions types/test/ssr-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ bundleRenderer.renderToString(context, (err, html) => {
const res: string = html;
});

bundleRenderer.renderToString().then(html => {
const res: string = html;
});

bundleRenderer.renderToString(context).then(html => {
const res: string = html;
});

bundleRenderer.renderToStream(context).on('data', chunk => {
const html = chunk.toString();
});
Expand Down

0 comments on commit fcc1229

Please sign in to comment.