- fix for typescript typing changes
This commit is contained in:
Eugene Zolenko 2017-09-26 18:34:25 -06:00
parent 2fe9435af8
commit 64e70d82e4
6 changed files with 21 additions and 14 deletions

2
dist/host.d.ts vendored
View File

@ -15,7 +15,7 @@ export declare class LanguageServiceHost implements tsTypes.LanguageServiceHost
getDefaultLibFileName(opts: tsTypes.CompilerOptions): string;
useCaseSensitiveFileNames(): boolean;
readDirectory(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[];
readFile(path: string, encoding?: string): string;
readFile(path: string, encoding?: string): string | undefined;
fileExists(path: string): boolean;
getTypeRootsVersion(): number;
directoryExists(directoryName: string): boolean;

View File

@ -43,7 +43,7 @@ var VerbosityLevel;
VerbosityLevel[VerbosityLevel["Info"] = 2] = "Info";
VerbosityLevel[VerbosityLevel["Debug"] = 3] = "Debug";
})(VerbosityLevel || (VerbosityLevel = {}));
var ConsoleContext = (function () {
var ConsoleContext = /** @class */ (function () {
function ConsoleContext(verbosity, prefix) {
if (prefix === void 0) { prefix = ""; }
this.verbosity = verbosity;
@ -72,7 +72,7 @@ var ConsoleContext = (function () {
return ConsoleContext;
}());
var RollupContext = (function () {
var RollupContext = /** @class */ (function () {
function RollupContext(verbosity, bail, context, prefix) {
if (prefix === void 0) { prefix = ""; }
this.verbosity = verbosity;
@ -124,7 +124,7 @@ function normalize(fileName) {
return fileName.split("\\").join("/");
}
var LanguageServiceHost = (function () {
var LanguageServiceHost = /** @class */ (function () {
function LanguageServiceHost(parsedConfig) {
this.parsedConfig = parsedConfig;
this.cwd = process.cwd();
@ -197,7 +197,7 @@ var LanguageServiceHost = (function () {
* Saves data in new cache folder or reads it from old one.
* Avoids perpetually growing cache and situations when things need to consider changed and then reverted data to be changed.
*/
var RollingCache = (function () {
var RollingCache = /** @class */ (function () {
/**
* @param cacheRoot: root folder for the cache
* @param checkNewCache: whether to also look in new cache when reading from cache
@ -281,7 +281,7 @@ function convertDiagnostic(type, data) {
return entry;
});
}
var TsCache = (function () {
var TsCache = /** @class */ (function () {
function TsCache(host, cache, options, rollupConfig, rootFilenames, context) {
var _this = this;
this.host = host;
@ -626,6 +626,8 @@ function typescript(options) {
if (watchMode && round === 0) {
context.debug("running in watch mode");
cache().walkTree(function (id) {
if (!filter$$1(id))
return;
var diagnostics = _.concat(convertDiagnostic("syntax", service.getSyntacticDiagnostics(id)), convertDiagnostic("semantic", service.getSemanticDiagnostics(id)));
printDiagnostics(context, diagnostics);
});

View File

@ -41,7 +41,7 @@ var VerbosityLevel;
VerbosityLevel[VerbosityLevel["Info"] = 2] = "Info";
VerbosityLevel[VerbosityLevel["Debug"] = 3] = "Debug";
})(VerbosityLevel || (VerbosityLevel = {}));
var ConsoleContext = (function () {
var ConsoleContext = /** @class */ (function () {
function ConsoleContext(verbosity, prefix) {
if (prefix === void 0) { prefix = ""; }
this.verbosity = verbosity;
@ -70,7 +70,7 @@ var ConsoleContext = (function () {
return ConsoleContext;
}());
var RollupContext = (function () {
var RollupContext = /** @class */ (function () {
function RollupContext(verbosity, bail, context, prefix) {
if (prefix === void 0) { prefix = ""; }
this.verbosity = verbosity;
@ -122,7 +122,7 @@ function normalize(fileName) {
return fileName.split("\\").join("/");
}
var LanguageServiceHost = (function () {
var LanguageServiceHost = /** @class */ (function () {
function LanguageServiceHost(parsedConfig) {
this.parsedConfig = parsedConfig;
this.cwd = process.cwd();
@ -195,7 +195,7 @@ var LanguageServiceHost = (function () {
* Saves data in new cache folder or reads it from old one.
* Avoids perpetually growing cache and situations when things need to consider changed and then reverted data to be changed.
*/
var RollingCache = (function () {
var RollingCache = /** @class */ (function () {
/**
* @param cacheRoot: root folder for the cache
* @param checkNewCache: whether to also look in new cache when reading from cache
@ -279,7 +279,7 @@ function convertDiagnostic(type, data) {
return entry;
});
}
var TsCache = (function () {
var TsCache = /** @class */ (function () {
function TsCache(host, cache, options, rollupConfig, rootFilenames, context) {
var _this = this;
this.host = host;
@ -624,6 +624,8 @@ function typescript(options) {
if (watchMode && round === 0) {
context.debug("running in watch mode");
cache().walkTree(function (id) {
if (!filter$$1(id))
return;
var diagnostics = concat(convertDiagnostic("syntax", service.getSyntacticDiagnostics(id)), convertDiagnostic("semantic", service.getSemanticDiagnostics(id)));
printDiagnostics(context, diagnostics);
});

View File

@ -39,7 +39,7 @@ export class LanguageServiceHost implements tsTypes.LanguageServiceHost
if (existsSync(fileName))
{
this.snapshots[fileName] = tsModule.ScriptSnapshot.fromString(tsModule.sys.readFile(fileName));
this.snapshots[fileName] = tsModule.ScriptSnapshot.fromString(tsModule.sys.readFile(fileName)!);
this.versions[fileName] = (this.versions[fileName] || 0) + 1;
return this.snapshots[fileName];
}
@ -84,7 +84,7 @@ export class LanguageServiceHost implements tsTypes.LanguageServiceHost
return tsModule.sys.readDirectory(path, extensions, exclude, include);
}
public readFile(path: string, encoding?: string): string
public readFile(path: string, encoding?: string): string | undefined
{
return tsModule.sys.readFile(path, encoding);
}

View File

@ -225,6 +225,9 @@ export default function typescript(options?: Partial<IOptions>)
cache().walkTree((id) =>
{
if (!filter(id))
return;
const diagnostics = _.concat(
convertDiagnostic("syntax", service.getSyntacticDiagnostics(id)),
convertDiagnostic("semantic", service.getSemanticDiagnostics(id)),

View File

@ -15,7 +15,7 @@ export function parseTsConfig(tsconfig: string, context: IContext, pluginOptions
throw new Error(`couldn't find '${tsconfig}' in ${process.cwd()}`);
const text = tsModule.sys.readFile(fileName);
const result = tsModule.parseConfigFileTextToJson(fileName, text);
const result = tsModule.parseConfigFileTextToJson(fileName, text!);
if (result.error)
{