Skip to content
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
5 changes: 2 additions & 3 deletions src/compiler/resolutionCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ namespace ts {

export const maxNumberOfFilesToIterateForInvalidation = 256;

interface GetResolutionWithResolvedFileName<T extends ResolutionWithFailedLookupLocations = ResolutionWithFailedLookupLocations, R extends ResolutionWithResolvedFileName = ResolutionWithResolvedFileName> {
(resolution: T): R;
}
type GetResolutionWithResolvedFileName<T extends ResolutionWithFailedLookupLocations = ResolutionWithFailedLookupLocations, R extends ResolutionWithResolvedFileName = ResolutionWithResolvedFileName> =
(resolution: T) => R;

export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootDirForResolution: string): ResolutionCache {
let filesWithChangedSetOfUnresolvedImports: Path[] | undefined;
Expand Down
4 changes: 1 addition & 3 deletions src/compiler/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
/// <reference path="diagnosticInformationMap.generated.ts"/>

namespace ts {
export interface ErrorCallback {
(message: DiagnosticMessage, length: number): void;
}
export type ErrorCallback = (message: DiagnosticMessage, length: number) => void;

/* @internal */
export function tokenIsIdentifierOrKeyword(token: SyntaxKind): boolean {
Expand Down
18 changes: 9 additions & 9 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2471,9 +2471,13 @@ namespace ts {
readFile(path: string): string | undefined;
}

export interface WriteFileCallback {
(fileName: string, data: string, writeByteOrderMark: boolean, onError: ((message: string) => void) | undefined, sourceFiles: ReadonlyArray<SourceFile>): void;
}
export type WriteFileCallback = (
fileName: string,
data: string,
writeByteOrderMark: boolean,
onError: ((message: string) => void) | undefined,
sourceFiles: ReadonlyArray<SourceFile>,
) => void;

export class OperationCanceledException { }

Expand Down Expand Up @@ -3582,9 +3586,7 @@ namespace ts {
}

/* @internal */
export interface TypeMapper {
(t: TypeParameter): Type;
}
export type TypeMapper = (t: TypeParameter) => Type;

export const enum InferencePriority {
Contravariant = 1 << 0, // Inference from contravariant position
Expand Down Expand Up @@ -4192,9 +4194,7 @@ namespace ts {
}

/* @internal */
export interface HasInvalidatedResolution {
(sourceFile: Path): boolean;
}
export type HasInvalidatedResolution = (sourceFile: Path) => boolean;

export interface CompilerHost extends ModuleResolutionHost {
getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
Expand Down
12 changes: 9 additions & 3 deletions src/harness/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,9 +784,15 @@ namespace Harness {
? IO.newLine() + `//# sourceURL=${IO.resolvePath(tcServicesFileName)}`
: "");

export interface SourceMapEmitterCallback {
(emittedFile: string, emittedLine: number, emittedColumn: number, sourceFile: string, sourceLine: number, sourceColumn: number, sourceName: string): void;
}
export type SourceMapEmitterCallback = (
emittedFile: string,
emittedLine: number,
emittedColumn: number,
sourceFile: string,
sourceLine: number,
sourceColumn: number,
sourceName: string,
) => void;

// Settings
export let userSpecifiedRoot = "";
Expand Down
4 changes: 1 addition & 3 deletions src/server/editorServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ namespace ts.server {

export type ProjectServiceEvent = ProjectsUpdatedInBackgroundEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent | ProjectInfoTelemetryEvent;

export interface ProjectServiceEventHandler {
(event: ProjectServiceEvent): void;
}
export type ProjectServiceEventHandler = (event: ProjectServiceEvent) => void;

export interface SafeList {
[name: string]: { match: RegExp, exclude?: (string | number)[][], types?: string[] };
Expand Down
4 changes: 1 addition & 3 deletions src/server/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ namespace ts.server {
getExternalFiles?(proj: Project): string[];
}

export interface PluginModuleFactory {
(mod: { typescript: typeof ts }): PluginModule;
}
export type PluginModuleFactory = (mod: { typescript: typeof ts }) => PluginModule;

/**
* The project root can be script info - if root is present,
Expand Down
4 changes: 2 additions & 2 deletions src/services/formatting/ruleOperationContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
namespace ts.formatting {

export class RuleOperationContext {
private readonly customContextChecks: { (context: FormattingContext): boolean; }[];
private readonly customContextChecks: ((context: FormattingContext) => boolean)[];

constructor(...funcs: { (context: FormattingContext): boolean; }[]) {
constructor(...funcs: ((context: FormattingContext) => boolean)[]) {
this.customContextChecks = funcs;
}

Expand Down
20 changes: 6 additions & 14 deletions tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1623,9 +1623,7 @@ declare namespace ts {
fileExists(path: string): boolean;
readFile(path: string): string | undefined;
}
interface WriteFileCallback {
(fileName: string, data: string, writeByteOrderMark: boolean, onError: ((message: string) => void) | undefined, sourceFiles: ReadonlyArray<SourceFile>): void;
}
type WriteFileCallback = (fileName: string, data: string, writeByteOrderMark: boolean, onError: ((message: string) => void) | undefined, sourceFiles: ReadonlyArray<SourceFile>) => void;
class OperationCanceledException {
}
interface CancellationToken {
Expand Down Expand Up @@ -3095,9 +3093,7 @@ declare namespace ts {
function isGetAccessor(node: Node): node is GetAccessorDeclaration;
}
declare namespace ts {
interface ErrorCallback {
(message: DiagnosticMessage, length: number): void;
}
type ErrorCallback = (message: DiagnosticMessage, length: number) => void;
interface Scanner {
getStartPos(): number;
getToken(): SyntaxKind;
Expand Down Expand Up @@ -7144,11 +7140,9 @@ declare namespace ts.server {
create(createInfo: PluginCreateInfo): LanguageService;
getExternalFiles?(proj: Project): string[];
}
interface PluginModuleFactory {
(mod: {
typescript: typeof ts;
}): PluginModule;
}
type PluginModuleFactory = (mod: {
typescript: typeof ts;
}) => PluginModule;
/**
* The project root can be script info - if root is present,
* or it could be just normalized path if root wasnt present on the host(only for non inferred project)
Expand Down Expand Up @@ -7418,9 +7412,7 @@ declare namespace ts.server {
readonly dts: number;
}
type ProjectServiceEvent = ProjectsUpdatedInBackgroundEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent | ProjectInfoTelemetryEvent;
interface ProjectServiceEventHandler {
(event: ProjectServiceEvent): void;
}
type ProjectServiceEventHandler = (event: ProjectServiceEvent) => void;
interface SafeList {
[name: string]: {
match: RegExp;
Expand Down
8 changes: 2 additions & 6 deletions tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1623,9 +1623,7 @@ declare namespace ts {
fileExists(path: string): boolean;
readFile(path: string): string | undefined;
}
interface WriteFileCallback {
(fileName: string, data: string, writeByteOrderMark: boolean, onError: ((message: string) => void) | undefined, sourceFiles: ReadonlyArray<SourceFile>): void;
}
type WriteFileCallback = (fileName: string, data: string, writeByteOrderMark: boolean, onError: ((message: string) => void) | undefined, sourceFiles: ReadonlyArray<SourceFile>) => void;
class OperationCanceledException {
}
interface CancellationToken {
Expand Down Expand Up @@ -2758,9 +2756,7 @@ declare namespace ts {
let sys: System;
}
declare namespace ts {
interface ErrorCallback {
(message: DiagnosticMessage, length: number): void;
}
type ErrorCallback = (message: DiagnosticMessage, length: number) => void;
interface Scanner {
getStartPos(): number;
getToken(): SyntaxKind;
Expand Down
1 change: 0 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"arrow-return-shorthand": false,
"ban-comma-operator": false,
"ban-types": false,
"callable-types": false,
"forin": false,
"member-access": false, // [true, "no-public"]
"no-conditional-assignment": false,
Expand Down