Parsing file fails sometimes if function being parsed starts on first line of the file.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 238
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
I have found an issue when parsing a script file where if the function I want to extract the value starts on the first line, sometimes the parsing fails to extract the value.
As a workaround, if I add a new line to the file with a blank comment on it before parsing then it always parses as expected.
Does anyone know what may cause this, and has this issue been seen before?
My colleague raised a similar issue before at https://github.com/dsherret/ts-morph/issues/1468 but we never heard of any reason this may occur.
Contributor guide
Research direction
No source file, test, or reproducible script is included. Start by reproducing the failure with the target function on the first line, then compare parsing with and without a leading blank comment; the related issue #1468 may provide additional context. Done means identifying the cause and making parsing consistently extract the function value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100