mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
review comments
This commit is contained in:
@@ -337,13 +337,11 @@ namespace ts {
|
||||
const compilerOptions: CompilerOptions = { moduleResolution: ModuleResolutionKind.NodeJs };
|
||||
const cache = createModuleResolutionCache("/", (f) => f);
|
||||
let resolution = resolveModuleName("a", "/sub/dir/foo.ts", compilerOptions, host, cache);
|
||||
checkResolvedModule(resolution.resolvedModule, {
|
||||
extension: Extension.Ts,
|
||||
isExternalLibraryImport: true,
|
||||
originalPath: "/sub/node_modules/a/index.ts",
|
||||
packageId: undefined,
|
||||
resolvedFileName: "/modules/a.ts",
|
||||
});
|
||||
checkResolvedModule(resolution.resolvedModule, createResolvedModule("/modules/a.ts", /*isExternalLibraryImport*/ true));
|
||||
|
||||
resolution = resolveModuleName("a", "/sub/foo.ts", compilerOptions, host, cache);
|
||||
checkResolvedModule(resolution.resolvedModule, createResolvedModule("/modules/a.ts", /*isExternalLibraryImport*/ true));
|
||||
|
||||
resolution = resolveModuleName("a", "/foo.ts", compilerOptions, host, cache);
|
||||
assert.isUndefined(resolution.resolvedModule, "lookup in parent directory doesn't hit the cache");
|
||||
});
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
tests/cases/compiler/monorepo/context/src/bindingkey.ts(1,29): error TS2307: Cannot find module '@loopback/context'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/monorepo/core/src/application.ts (0 errors) ====
|
||||
import { Constructor } from "@loopback/context";
|
||||
export type ControllerClass = Constructor<any>;
|
||||
==== tests/cases/compiler/monorepo/core/src/usage.ts (0 errors) ====
|
||||
import { ControllerClass } from './application';
|
||||
import { BindingKey } from '@loopback/context';
|
||||
|
||||
export const CONTROLLER_CLASS = BindingKey.create<ControllerClass>(null as any); // line in question
|
||||
==== tests/cases/compiler/monorepo/context/src/value-promise.ts (0 errors) ====
|
||||
export type Constructor<T> = (...args: any[]) => T;
|
||||
==== tests/cases/compiler/monorepo/context/src/bindingkey.ts (1 errors) ====
|
||||
import { Constructor } from "@loopback/context"
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module '@loopback/context'.
|
||||
export class BindingKey<T> {
|
||||
readonly __type: T;
|
||||
static create<T extends Constructor<any>>(ctor: T) {
|
||||
return new BindingKey<T>();
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/monorepo/context/index.ts (0 errors) ====
|
||||
export * from "./src/value-promise";
|
||||
export * from "./src/bindingkey";
|
||||
|
||||
@@ -15,9 +15,9 @@ import { BindingKey } from '@loopback/context';
|
||||
export const CONTROLLER_CLASS = BindingKey.create<ControllerClass>(null as any); // line in question
|
||||
>CONTROLLER_CLASS : BindingKey<import("tests/cases/compiler/monorepo/context/src/value-promise").Constructor<any>>
|
||||
>BindingKey.create<ControllerClass>(null as any) : BindingKey<import("tests/cases/compiler/monorepo/context/src/value-promise").Constructor<any>>
|
||||
>BindingKey.create : <T extends any>(ctor: T) => BindingKey<T>
|
||||
>BindingKey.create : <T extends import("tests/cases/compiler/monorepo/context/src/value-promise").Constructor<any>>(ctor: T) => BindingKey<T>
|
||||
>BindingKey : typeof BindingKey
|
||||
>create : <T extends any>(ctor: T) => BindingKey<T>
|
||||
>create : <T extends import("tests/cases/compiler/monorepo/context/src/value-promise").Constructor<any>>(ctor: T) => BindingKey<T>
|
||||
>null as any : any
|
||||
>null : null
|
||||
|
||||
@@ -37,7 +37,7 @@ export class BindingKey<T> {
|
||||
>__type : T
|
||||
|
||||
static create<T extends Constructor<any>>(ctor: T) {
|
||||
>create : <T extends any>(ctor: T) => BindingKey<T>
|
||||
>create : <T extends Constructor<any>>(ctor: T) => BindingKey<T>
|
||||
>ctor : T
|
||||
|
||||
return new BindingKey<T>();
|
||||
|
||||
@@ -22,4 +22,4 @@ export class BindingKey<T> {
|
||||
export * from "./src/value-promise";
|
||||
export * from "./src/bindingkey";
|
||||
|
||||
// @link: tests/cases/compiler/monorepo/context -> tests/cases/compiler/monorepo/core/node_modules/@loopback/context
|
||||
// @link: tests/cases/compiler/monorepo/context -> tests/cases/compiler/monorepo/node_modules/@loopback/context
|
||||
Reference in New Issue
Block a user