Skip to content

Commit

Permalink
fix(language-service): Remove tsserverlibrary from rollup globals
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kyliau committed Apr 25, 2019
1 parent a400429 commit 8e89849
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/language-service/bundles/BUILD.bazel
Expand Up @@ -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__"],
Expand Down
9 changes: 5 additions & 4 deletions packages/language-service/src/ts_plugin.ts
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8e89849

Please sign in to comment.