mark LanguageService.getSourceFile as internal and rename it by vladima · Pull Request #7584 · microsoft/TypeScript

Skip to content

Navigation Menu

Sign in

Appearance settings

Conversation

@vladima

fixes #7581.
LanguageService.getSourceFile is a very confusing method - it returns one non-bound source file that is only useful for syntactic analysis. The only consumer of this method uses it to reliably determine if file is an external module.

…urceFile and mark it as internal

@mhegazy

this is a breaking change, i remeber other users used it..
// cc: @basarat.

@basarat

@jbrantly

Thanks for the mention. ts-loader doesn't use this method so I think it's unaffected.

@mhegazy

@vladima

@mprobst

Thanks for the heads up. I don't think we use this method, we just use ts.createSourceFile, so we should be good.

@blakeembrey

Ah, I do use it in ts-node 😦 Do you know if source maps generate properly with inline contents now, that's all I was using it for.

@vladima

Will it work if you replace it with LanguageService.getProgram().getSourceFile?

@blakeembrey

@vladima Yes, definitely. Don't worry about it, I'll look into fixing it at the source too some time.

@adidahiya

👍 TSLint is not using ts.getSourceFile directly.

@DanielRosenwasser

@vladima vladima deleted the LS-rename-getSourceFile branch

March 24, 2016 21:05

@microsoft microsoft locked and limited conversation to collaborators

Jun 19, 2018

Labels