-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added TypeScript basics #65
base: master
Are you sure you want to change the base?
Conversation
Added TypeScript basics based on issue #64 conversation.
@Kevin-at-Navigram - adding it to the readme definitely sounds helpful to me. But as a general thought, adding just tree parsing example might not be enough? @joaonuno I am not sure how other projects cover this dual documentation dilemma. If we add just TS examples, they are somewhat understandable for plain JS users, but might not be very obvious. On the other hand, TS users might need some handholding (examples) for the generic parameters. |
@bendtherules Not sure how much documentation would be really required. This seems like enough to get going. JavaScript (ES 6) and TypeScipt go hand in hand, but I've never really found a project which documents both well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I think this is helpful!
@@ -159,6 +159,26 @@ node.walk([options], action, [context]) | |||
|
|||
These functions can also take, as the last parameter, the *context* on which the action will be called. | |||
|
|||
## Typescript Refrence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets call this TypeScript Example because it's not really a reference
## Typescript Refrence | |
## TypeScript Example |
import * as TreeModel from "tree-model"; | ||
|
||
interface TestModel { | ||
name: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like a more complete example that also type checks the children, maybe:
name: string; | |
name: string, | |
children?: Array<TestModel> |
But I don't know enough TypeScript...
Added TypeScript basics based on issue #64 conversation.