mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-31 18:10:56 -05:00
Enable strictFunctionTypes (#49929)
This commit is contained in:
@@ -733,7 +733,7 @@ function forEachResolvedProjectReferenceProjectWorker<T>(
|
||||
|
||||
function forEachPotentialProjectReference<T>(
|
||||
project: ConfiguredProject,
|
||||
cb: (potentialProjectReference: Path) => T | undefined
|
||||
cb: (potentialProjectReference: NormalizedPath) => T | undefined
|
||||
): T | undefined {
|
||||
return project.potentialProjectReferences &&
|
||||
forEachKey(project.potentialProjectReferences, cb);
|
||||
@@ -743,7 +743,7 @@ function forEachAnyProjectReferenceKind<T>(
|
||||
project: ConfiguredProject,
|
||||
cb: (resolvedProjectReference: ResolvedProjectReference) => T | undefined,
|
||||
cbProjectRef: (projectReference: ProjectReference) => T | undefined,
|
||||
cbPotentialProjectRef: (potentialProjectReference: Path) => T | undefined
|
||||
cbPotentialProjectRef: (potentialProjectReference: NormalizedPath) => T | undefined
|
||||
): T | undefined {
|
||||
return project.getCurrentProgram() ?
|
||||
project.forEachResolvedProjectReference(cb) :
|
||||
@@ -752,10 +752,10 @@ function forEachAnyProjectReferenceKind<T>(
|
||||
forEach(project.getProjectReferences(), cbProjectRef);
|
||||
}
|
||||
|
||||
function callbackRefProject<T>(
|
||||
function callbackRefProject<T, P extends string>(
|
||||
project: ConfiguredProject,
|
||||
cb: (refProj: ConfiguredProject) => T | undefined,
|
||||
refPath: Path | undefined
|
||||
refPath: P | undefined
|
||||
) {
|
||||
const refProject = refPath && project.projectService.configuredProjects.get(refPath);
|
||||
return refProject && cb(refProject);
|
||||
|
||||
@@ -2548,7 +2548,7 @@ export class ConfiguredProject extends Project {
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
potentialProjectReferences: Set<string> | undefined;
|
||||
potentialProjectReferences: Set<NormalizedPath> | undefined;
|
||||
|
||||
/** @internal */
|
||||
projectOptions?: ProjectOptions | true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
arrayFrom,
|
||||
arrayReverseIterator,
|
||||
BufferEncoding,
|
||||
CallHierarchyIncomingCall,
|
||||
CallHierarchyItem,
|
||||
CallHierarchyOutgoingCall,
|
||||
@@ -194,7 +195,7 @@ export const nullCancellationToken: ServerCancellationToken = {
|
||||
resetRequest: () => void 0
|
||||
};
|
||||
|
||||
function hrTimeToMilliseconds(time: number[]): number {
|
||||
function hrTimeToMilliseconds(time: [number, number]): number {
|
||||
const seconds = time[0];
|
||||
const nanoseconds = time[1];
|
||||
return ((1e9 * seconds) + nanoseconds) / 1000000.0;
|
||||
@@ -307,7 +308,7 @@ function allEditsBeforePos(edits: readonly TextChange[], pos: number): boolean {
|
||||
export type CommandNames = protocol.CommandTypes;
|
||||
export const CommandNames = (protocol as any).CommandTypes;
|
||||
|
||||
export function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string {
|
||||
export function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: BufferEncoding) => number, newLine: string): string {
|
||||
const verboseLogging = logger.hasLevel(LogLevel.verbose);
|
||||
|
||||
const json = JSON.stringify(msg);
|
||||
@@ -915,8 +916,8 @@ export interface SessionOptions {
|
||||
useSingleInferredProject: boolean;
|
||||
useInferredProjectPerProjectRoot: boolean;
|
||||
typingsInstaller: ITypingsInstaller;
|
||||
byteLength: (buf: string, encoding?: string) => number;
|
||||
hrtime: (start?: number[]) => number[];
|
||||
byteLength: (buf: string, encoding?: BufferEncoding) => number;
|
||||
hrtime: (start?: [number, number]) => [number, number];
|
||||
logger: Logger;
|
||||
/**
|
||||
* If falsy, all events are suppressed.
|
||||
@@ -950,8 +951,8 @@ export class Session<TMessage = string> implements EventSender {
|
||||
protected host: ServerHost;
|
||||
private readonly cancellationToken: ServerCancellationToken;
|
||||
protected readonly typingsInstaller: ITypingsInstaller;
|
||||
protected byteLength: (buf: string, encoding?: string) => number;
|
||||
private hrtime: (start?: number[]) => number[];
|
||||
protected byteLength: (buf: string, encoding?: BufferEncoding) => number;
|
||||
private hrtime: (start?: [number, number]) => [number, number];
|
||||
protected logger: Logger;
|
||||
|
||||
protected canUseEvents: boolean;
|
||||
@@ -3099,7 +3100,7 @@ export class Session<TMessage = string> implements EventSender {
|
||||
return { response, responseRequired: true };
|
||||
}
|
||||
|
||||
private handlers = new Map(Object.entries<(request: protocol.Request) => HandlerResponse>({
|
||||
private handlers = new Map(Object.entries<(request: any) => HandlerResponse>({ // TODO(jakebailey): correctly type the handlers
|
||||
[CommandNames.Status]: () => {
|
||||
const response: protocol.StatusResponseBody = { version };
|
||||
return this.requiredResponse(response);
|
||||
@@ -3544,7 +3545,7 @@ export class Session<TMessage = string> implements EventSender {
|
||||
|
||||
this.performanceData = undefined;
|
||||
|
||||
let start: number[] | undefined;
|
||||
let start: [number, number] | undefined;
|
||||
if (this.logger.hasLevel(LogLevel.requestTime)) {
|
||||
start = this.hrtime();
|
||||
if (this.logger.hasLevel(LogLevel.verbose)) {
|
||||
|
||||
Reference in New Issue
Block a user