-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New: add TypeScript definitions (#39)
- Try to mimic the Preact TSD. - Example usage with `noImplicitAny` enabled: import { render } from "preact-render-to-string"; - No idea if I've done it right but it seems to compile and hopefully someone more knowledgeable can build on this.
- Loading branch information
1 parent
80801f7
commit 5215613
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { VNode } from 'preact'; | ||
|
||
declare module render { | ||
interface Options { | ||
shallow:boolean; | ||
xml:boolean; | ||
pretty:boolean; | ||
} | ||
|
||
function render(vnode:VNode, context?:any, options?:Options):string; | ||
function shallowRender(vnode:VNode, context?:any):string; | ||
} | ||
|
||
export = render; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "preact-render-to-string", | ||
"main": "src/index.d.ts", | ||
"version": false | ||
} |