Skip to content

IScriptSnapshot getChangeRange should allow undefined return value #9843

@cgauld

Description

@cgauld

TypeScript Version: nightly

Expected behavior:
The typescriptServices.d.ts file signature for getChangeRange in the IScriptSnapshot interface should allow implementations to return undefined - as mentioned in its accompanying comment:

interface IScriptSnapshot {
       // [...omitted...]
        /**
         * Gets the TextChangeRange that describe how the text changed between this text and
         * an older version.  This information is used by the incremental parser to determine
         * what sections of the script need to be re-parsed.  'undefined' can be returned if the
         * change range cannot be determined.  However, in that case, incremental parsing will
         * not happen and the entire document will be re - parsed.
         */
        getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined;

       // [...omitted...]
    }

Actual behavior:
It currently does not :-)

interface IScriptSnapshot {
       // [...omitted...]
        /**
         * Gets the TextChangeRange that describe how the text changed between this text and
         * an older version.  This information is used by the incremental parser to determine
         * what sections of the script need to be re-parsed.  'undefined' can be returned if the
         * change range cannot be determined.  However, in that case, incremental parsing will
         * not happen and the entire document will be re - parsed.
         */
        getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange;

       // [...omitted...]
    }

I may be missing something however so apologies if I'm off the mark here!

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIRelates to the public API for TypeScriptBugA bug in TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions