Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added TypeScript basics #65

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Apr 5, 2019

Added TypeScript basics based on issue #64 conversation.

Added TypeScript basics based on issue #64 conversation.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.802% when pulling 07bc4da on Kevin-at-Navigram:patch-1 into 1ac126a on joaonuno:master.

@bendtherules
Copy link

@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.

@ghost
Copy link
Author

ghost commented Apr 8, 2019

@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.

Copy link
Owner

@joaonuno joaonuno left a 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
Copy link
Owner

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

Suggested change
## Typescript Refrence
## TypeScript Example

import * as TreeModel from "tree-model";

interface TestModel {
name: string;
Copy link
Owner

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:

Suggested change
name: string;
name: string,
children?: Array<TestModel>

But I don't know enough TypeScript...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants