Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix baseline merge
  • Loading branch information
andrewbranch authored and timsuchanek committed Sep 11, 2019
commit 25fa027721d8f3e7451119f0c9ca8ef5d59301cc
2 changes: 1 addition & 1 deletion tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2026,7 +2026,7 @@ declare namespace ts {
*/
runWithCancellationToken<T>(token: CancellationToken, cb: (checker: TypeChecker) => T): T;
}
enum ContextFlags {
export enum ContextFlags {
None = 0,
Signature = 1,
Completion = 2
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2026,12 +2026,12 @@ declare namespace ts {
*/
runWithCancellationToken<T>(token: CancellationToken, cb: (checker: TypeChecker) => T): T;
}
enum ContextFlags {
export enum ContextFlags {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this as well as new signature need to be internal

Copy link
Contributor Author

@timsuchanek timsuchanek Sep 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean we should use something different than the ContextFlags when calling the code from the completion service to prevent this type being exposed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Sheetal means to move ContextFlags into one of the ts namespaces that’s already marked /** @internal */ and then to mark the second parameter of TypeChecker['getContextualType'] as /* @internal */ (or declare it as an internal overload, but the linter might call that an unnecessary overload)

Copy link
Contributor Author

@timsuchanek timsuchanek Sep 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense! The overload option indeed makes the linter complain:

ERROR: /Users/tim/code/TypeScript/src/compiler/types.ts:3224:61 unified-signatures These overloads can be combined into one signature with an optional parameter.

The non-overload option, which I wrote like this:

        getContextualType(
            node: Expression,
            /* @internal */ contextFlags?: ContextFlags
        ): Type | undefined;

spits out an invalid typescript.d.ts:

        getRootSymbols(symbol: Symbol): ReadonlyArray<Symbol>;
        getContextualType(node: Expression, 
: Type | undefined;
        /**
         * returns unknownSignature in the case of an error.
         * returns undefined if the node is not valid.
         * @param argumentCount Apparent number of arguments, passed in case of a possibly incomplete call. This should come from an ArgumentListInfo. See `signatureHelp.ts`.
         */

Is there a way to ignore the linter in this case?
Or what is the right way to add @internal to a specific argument?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just filed #33350. I think it would be ok to ignore the line from the linter. @sheetalkamat?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes in past we have marked the overload internal and disabled the rule for that line.

Copy link
Contributor Author

@timsuchanek timsuchanek Sep 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Had to adjust the tests because of #32266

Anything else you need from my side to get this merged?
@sheetalkamat @andrewbranch

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, this doesn’t even touch the public API baselines now. Would be good to get an approval from another person on the team but I think this is good.

None = 0,
Signature = 1,
Completion = 2
}
enum NodeBuilderFlags {
export enum NodeBuilderFlags {
None = 0,
NoTruncation = 1,
WriteArrayAsGenericType = 2,
Expand Down