Commit 150508f
feat: add TypeScript helpers (#566)
* create ast.ts
* handle annotations for more node types and add class props helpers
* refactoring
* refactoring and adding methods back
* adding tests
* implement Oliver's suggestions
* update functions tests
* add class tests
* wrap node in class if it's a method
* add methods tests, unnest tests
* add isUnionOf and isIntersectionOf
* add more methods, fix bug in hasReturnAnnotation
* add getParameters tests and initial annotation tests [skip ci]
* refactor: nitpicks and formatting
* refactor: use optional chaining
* refactor: use helper function to simplify hasTypeProp
* feat: make Explorer available in tests
* fix: use environment specific loader for dynamic imports
* chore: ignore eslint
* Apply suggestions from code review
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
* fix errors, remove isUnionOf and isIntersectionOf
* rename find<Nodes> to get<Nodes>
* refactor: use setup file for slow task (webpack)
* test matches with empty trees
* refactor: remove type casts from getAll
* refactor: simplify types
Mostly by using TS's built in type predicates
---------
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>1 parent 520a3b4 commit 150508f
File tree
8 files changed
+1764
-66
lines changed- packages
- helpers/lib
- class
- tests
- integration-tests
8 files changed
+1764
-66
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
21 | 33 | | |
22 | 34 | | |
23 | 35 | | |
| |||
37 | 49 | | |
38 | 50 | | |
39 | 51 | | |
| 52 | + | |
| 53 | + | |
0 commit comments