Skip to content
Permalink
Browse files

fix(language-service): Remove tsserverlibrary from rollup globals (#3…

…0123)

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
  • Loading branch information...
kyliau authored and AndrewKushnir committed Apr 25, 2019
1 parent c6f95b1 commit b706800ea8895db3f25eb75ca3f41fdee84ee9ec
Showing with 5 additions and 5 deletions.
  1. +0 −1 packages/language-service/bundles/BUILD.bazel
  2. +5 −4 packages/language-service/src/ts_plugin.ts
@@ -7,7 +7,6 @@ ls_rollup_bundle(
"fs": "fs",
"path": "path",
"typescript": "ts",
"typescript/lib/tsserverlibrary": "tsserverlibrary",
},
license_banner = "banner.js.txt",
visibility = ["//packages/language-service:__pkg__"],
@@ -6,15 +6,16 @@
* found in the LICENSE file at https://angular.io/license
*/

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

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

const projectHostMap = new WeakMap<ts.server.Project, TypeScriptServiceHost>();
const projectHostMap = new WeakMap<tss.server.Project, TypeScriptServiceHost>();

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

export function create(info: ts.server.PluginCreateInfo): ts.LanguageService {
export function create(info: tss.server.PluginCreateInfo): ts.LanguageService {
const oldLS: ts.LanguageService = info.languageService;
const proxy: ts.LanguageService = Object.assign({}, oldLS);
const logger = info.project.projectService.logger;

0 comments on commit b706800

Please sign in to comment.
You can’t perform that action at this time.