Browse Source

fix(types): add missing ssr renderToString signature

dev
Evan You 7 years ago
parent
commit
14e99086c0
  1. 1
      packages/vue-server-renderer/types/index.d.ts
  2. 8
      types/test/ssr-test.ts

1
packages/vue-server-renderer/types/index.d.ts

@ -11,6 +11,7 @@ interface Renderer {
renderToString(vm: Vue, callback: RenderCallback): void;
renderToString(vm: Vue, context: object, callback: RenderCallback): void;
renderToString(vm: Vue): Promise<string>;
renderToString(vm: Vue, context: object): Promise<string>;
renderToStream(vm: Vue, context?: object): Readable;
}

8
types/test/ssr-test.ts

@ -46,6 +46,14 @@ renderer.renderToString(app)
throw err;
});
renderer.renderToString(app, context)
.then(html => {
const res: string = html;
})
.catch(err => {
throw err;
});
renderer.renderToStream(app, context).on('data', chunk => {
const html = chunk.toString();
});

Loading…
Cancel
Save