microsoft / microsoft/TypeScript

Document and/or deprecate Node's getFullStart() vs. pos?

Open
#57,053 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Help Wanted Infrastructure
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

Acknowledgement
  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment

Coming over from https://github.com/typescript-eslint/typescript-eslint/issues/8227 -> https://discord.com/channels/508357248330760243/640177429775777792/1194002057858916483: it looks like ts.Node objects have both a pos: number property and a getFullStart(): number method that directly returns this.pos:

https://github.com/microsoft/TypeScript/blob/02f9ddf55d27716c0306ec6561baf80d42744fed/src/services/services.ts#L564-L566

Doing some quick Find all references from the interfaces' definitions in VS Code:

  • Node's getFullStart() has 25 results
  • ReadonlyTextRanges readonly pos has 407 results

I looked through the GitHub repo and code history but couldn't find anything justifying why both exist. My hunch is maybe that #9529 which added getFullStart() predates TS 2.0's readonly (TS 2.0 release notes > readonly)?

Given that getFullStart() incurs an extra function call, is there any reason beyond backwards compatibility to keep it around? If not, would the team be open to marking it as @deprecated in JSDoc to reduce ambiguity?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/services/services.ts around the referenced getFullStart() implementation, then compare the Node and ReadonlyTextRange interface definitions and the linked history around #9529. Determine whether the two APIs have a documented distinction and whether deprecation is appropriate; done means recording the rationale or deprecation decision in the relevant TypeScript API documentation or JSDoc.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.