Skip to content

Commit b706800

Browse files
Keen Yee LiauAndrewKushnir
Keen Yee Liau
authored andcommittedApr 26, 2019
fix(language-service): Remove tsserverlibrary from rollup globals (#30123)
This PR removes `tsserverlibrary` from rollup globals since the symbol should not appear by the time rollup is invoked. `tsserverlibrary` is used for types only, so the import statement should not be emitted by tsc. PR Close #30123
1 parent c6f95b1 commit b706800

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎packages/language-service/bundles/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ ls_rollup_bundle(
77
"fs": "fs",
88
"path": "path",
99
"typescript": "ts",
10-
"typescript/lib/tsserverlibrary": "tsserverlibrary",
1110
},
1211
license_banner = "banner.js.txt",
1312
visibility = ["//packages/language-service:__pkg__"],

‎packages/language-service/src/ts_plugin.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import * as ts from 'typescript/lib/tsserverlibrary';
9+
import * as ts from 'typescript'; // used as value, passed in by tsserver at runtime
10+
import * as tss from 'typescript/lib/tsserverlibrary'; // used as type only
1011

1112
import {createLanguageService} from './language_service';
1213
import {Completion, Diagnostic, DiagnosticMessageChain} from './types';
1314
import {TypeScriptServiceHost} from './typescript_host';
1415

15-
const projectHostMap = new WeakMap<ts.server.Project, TypeScriptServiceHost>();
16+
const projectHostMap = new WeakMap<tss.server.Project, TypeScriptServiceHost>();
1617

17-
export function getExternalFiles(project: ts.server.Project): string[]|undefined {
18+
export function getExternalFiles(project: tss.server.Project): string[]|undefined {
1819
const host = projectHostMap.get(project);
1920
if (host) {
2021
const externalFiles = host.getTemplateReferences();
@@ -63,7 +64,7 @@ function diagnosticToDiagnostic(d: Diagnostic, file: ts.SourceFile): ts.Diagnost
6364
return result;
6465
}
6566

66-
export function create(info: ts.server.PluginCreateInfo): ts.LanguageService {
67+
export function create(info: tss.server.PluginCreateInfo): ts.LanguageService {
6768
const oldLS: ts.LanguageService = info.languageService;
6869
const proxy: ts.LanguageService = Object.assign({}, oldLS);
6970
const logger = info.project.projectService.logger;

0 commit comments

Comments
 (0)
Please sign in to comment.