Skip to content

Fix #8271: Add undefined type to index signatures #8284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2512,14 +2512,14 @@ namespace ts {
types?: string[];

list?: string[];
[option: string]: CompilerOptionsValue;
[option: string]: CompilerOptionsValue | undefined;
}

export interface TypingOptions {
enableAutoDiscovery?: boolean;
include?: string[];
exclude?: string[];
[option: string]: string[] | boolean;
[option: string]: string[] | boolean | undefined;
}

export interface DiscoverTypingsInfo {
Expand Down
2 changes: 1 addition & 1 deletion src/services/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ namespace ts {
getScriptFileNames(): string[];
getScriptKind?(fileName: string): ScriptKind;
getScriptVersion(fileName: string): string;
getScriptSnapshot(fileName: string): IScriptSnapshot;
getScriptSnapshot(fileName: string): IScriptSnapshot | undefined;
getLocalizedDiagnosticMessages?(): any;
getCancellationToken?(): HostCancellationToken;
getCurrentDirectory(): string;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function delint(sourceFile: ts.SourceFile) {
}
}

const fileNames = process.argv.slice(2);
const fileNames: string[] = process.argv.slice(2);
fileNames.forEach(fileName => {
// Parse a file
let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true);
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_parseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function printError(error: ts.Diagnostic): void {
console.log(`${error.file && error.file.fileName}: ${error.messageText}`);
}

export function createProgram(rootFiles: string[], compilerOptionsJson: string): ts.Program {
export function createProgram(rootFiles: string[], compilerOptionsJson: string): ts.Program | undefined {
const { config, error } = ts.parseConfigFileTextToJson("tsconfig.json", compilerOptionsJson)
if (error) {
printError(error);
Expand Down
8 changes: 7 additions & 1 deletion tests/baselines/reference/APISample_watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@

declare var process: any;
declare var console: any;
declare var fs: any;
declare var fs: {
existsSync(path: string): boolean;
readdirSync(path: string): string[];
readFileSync(filename: string, encoding?: string): string;
writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: { mtime: Date }, prev: { mtime: Date }) => void): void;
};
declare var path: any;

import * as ts from "typescript";
Expand Down
3 changes: 2 additions & 1 deletion tests/cases/compiler/APISample_compile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @module: commonjs
// @includebuiltfile: typescript_standalone.d.ts
// @stripInternal:true
// @noImplicitAny:true
// @strictNullChecks:true

/*
* Note: This test is a public API sample. The sample sources can be found
Expand Down
5 changes: 3 additions & 2 deletions tests/cases/compiler/APISample_linter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @module: commonjs
// @includebuiltfile: typescript_standalone.d.ts
// @stripInternal:true
// @noImplicitAny:true
// @strictNullChecks:true

/*
* Note: This test is a public API sample. The sample sources can be found
Expand Down Expand Up @@ -57,7 +58,7 @@ export function delint(sourceFile: ts.SourceFile) {
}
}

const fileNames = process.argv.slice(2);
const fileNames: string[] = process.argv.slice(2);
fileNames.forEach(fileName => {
// Parse a file
let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true);
Expand Down
5 changes: 3 additions & 2 deletions tests/cases/compiler/APISample_parseConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @module: commonjs
// @includebuiltfile: typescript_standalone.d.ts
// @stripInternal:true
// @noImplicitAny:true
// @strictNullChecks:true

/*
* Note: This test is a public API sample. The sample sources can be found
Expand All @@ -21,7 +22,7 @@ function printError(error: ts.Diagnostic): void {
console.log(`${error.file && error.file.fileName}: ${error.messageText}`);
}

export function createProgram(rootFiles: string[], compilerOptionsJson: string): ts.Program {
export function createProgram(rootFiles: string[], compilerOptionsJson: string): ts.Program | undefined {
const { config, error } = ts.parseConfigFileTextToJson("tsconfig.json", compilerOptionsJson)
if (error) {
printError(error);
Expand Down
3 changes: 2 additions & 1 deletion tests/cases/compiler/APISample_transform.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @module: commonjs
// @includebuiltfile: typescript_standalone.d.ts
// @stripInternal:true
// @noImplicitAny:true
// @strictNullChecks:true

/*
* Note: This test is a public API sample. The sample sources can be found
Expand Down
11 changes: 9 additions & 2 deletions tests/cases/compiler/APISample_watcher.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @module: commonjs
// @includebuiltfile: typescript_standalone.d.ts
// @stripInternal:true
// @noImplicitAny:true
// @strictNullChecks:true

/*
* Note: This test is a public API sample. The sample sources can be found
Expand All @@ -10,7 +11,13 @@

declare var process: any;
declare var console: any;
declare var fs: any;
declare var fs: {
existsSync(path: string): boolean;
readdirSync(path: string): string[];
readFileSync(filename: string, encoding?: string): string;
writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: { mtime: Date }, prev: { mtime: Date }) => void): void;
};
declare var path: any;

import * as ts from "typescript";
Expand Down