Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Mar 7, 2018

Now the only fix left not using ChangeTracker is fixJSDocTypes, which could probably be changed in a similar way.

@ghost ghost requested a review from mhegazy March 7, 2018 17:12

function getTypeAccessiblityWriter(checker: TypeChecker): EmitTextWriter {
let str = "";
function isTypeAccessible(type: Type, enclosingDeclaration: Declaration, checker: TypeChecker): boolean {
Copy link
Author

Choose a reason for hiding this comment

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

@weswigham Is there a better way to do this now?

Copy link
Member

Choose a reason for hiding this comment

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

typeToTypeNode itself should have an argument that lets you pass in visibility tracking hooks in the same way without needing to print the type.

Copy link
Author

Choose a reason for hiding this comment

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

Had to add that parameter as an internal overload -- should it be public?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want to encourage using it? EmitTextWriter is internal, so it's not like the other method was public.

Copy link
Author

@ghost ghost Mar 7, 2018

Choose a reason for hiding this comment

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

OK, will leave it internal. (#22384)

@ghost ghost force-pushed the inferFromUsage_textChanges branch from 8360377 to 316073b Compare March 7, 2018 18:18
@ghost ghost force-pushed the inferFromUsage_textChanges branch from 316073b to e58d270 Compare March 7, 2018 18:32
this.replaceRange(sourceFile, { pos, end: pos }, createToken(modifier), { suffix: " " });
}

public insertTypeAnnotation(sourceFile: SourceFile, node: TypeAnnotatable, type: TypeNode): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

so why not just replaceNode with a node with a type annotation?

Copy link
Author

Choose a reason for hiding this comment

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

To avoid an issue like #22358 -- we should be adding new text but not reformatting existing text

Copy link
Contributor

Choose a reason for hiding this comment

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

i see.. we should add a comment for that then..

@ghost ghost merged commit e5804ae into master Mar 7, 2018
@ghost ghost deleted the inferFromUsage_textChanges branch March 7, 2018 22:40
@ghost ghost mentioned this pull request Mar 7, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants