Skip to content

Commit c71d5bc

Browse files
fix: add typing doc
1 parent f47fa46 commit c71d5bc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

website/guide/pattern-syntax.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ through the full syntax tree, so pattern can also match nested expression. For e
1010
code.
1111

1212
```javascript
13-
1413
const b = a + 1
1514

1615
funcCall(a + 1)

website/reference/api.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ class SgNode {
117117
isNamed(): boolean
118118
isNamedLeaf(): boolean
119119
kind(): string
120+
// check if node has kind
121+
is(kind: string): boolean
122+
// for TypeScript type narrow
123+
kindToRefine: string
120124
text(): string
121125
// Check if node meets certain patterns
122126
matches(m: string): boolean
@@ -147,6 +151,8 @@ class SgNode {
147151
}
148152
```
149153

154+
Some methods have more sophisticated type signature for the ease of use. See the [source code](https://github.com/ast-grep/ast-grep/blob/0999cdb542ff4431e3734dad38fcd648de972e6a/crates/napi/types/sgnode.d.ts#L38-L41) and our [tech blog](/blog/typed-napi.html)
155+
150156
### NapiConfig
151157

152158
`NapiConfig` is used in `find` or `findAll`.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy