-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Dynamic import in generated .d.ts file has incorrect module name #26000
Comments
@weswigham can you take a look |
FYI we have ten occurrences of this in our 6,000-file codebase. Would love to see it fixed in 3.0.2 if possible! |
This is marked with milestone "TypeScript 3.1", but is not yet fixed in v3.1-rc. Do you still hope to fix this in 3.1? |
I've been a weeeeee bit overprovisioned for 3.1, so.... maybe? Depends if we can get a satisfactory fix in and reviewed before the branch cut next week. |
haha ok :) |
@mmorearty have you checked your project on the latest nightlies (again)? I ran your repro against /// <reference path="lib/lib.d.ts" />
declare module "common/datastore_result" {
import { Result } from "luna/web/tsutil/result";
export type DatastoreResult<T> = Result<Error, T>;
export type T<T> = DatastoreResult<T>;
}
declare module "common/handle_map" {
class HandleMap<T> {
forEach(func: (value: T, syncableId: string) => void): void;
}
export { HandleMap as default };
}
declare module "optimistic_updates/optimistic_updates" {
export function updateListScv(valueMutation: any): any;
}
declare module "projection/fields/server_computed_value_field" {
export type ScvPrimitive = null | boolean | number | string;
export const getScvResult: () => import("luna/web/tsutil/result").Result<Error, import("projection/server_computed_value").DatastoreServerComputedValue>;
}
declare module "projection/server_computed_value" {
export type DatastoreServerComputedValue = null | boolean | number | string | string[];
class ServerComputedValue {
value(): DatastoreServerComputedValue;
}
export { ServerComputedValue as default };
} so this may have been a dupe of another issue we already fixed. |
It's fixed for me! I compiled our entire codebase with 3.1.0-dev.20180915, and it worked. 🍾 |
Note, this issue may look familiar, because the sample code is very similar to the sample code I posted in #25714. But this is a different (albeit perhaps related) issue.
Also, see similar issues at the bottom of this report.
TypeScript Version: 3.1.0-dev.20180727, and also 2.9.2 after I cherry-pick the fix for #25714
Search Terms:
dynamic import d.ts
relative import d.ts
Code
Here is a self-contained zip file that has:
build.sh
, which just runstsc
with appropriate argumentsrepro.zip
Expected behavior:
In the generated .d.ts file, for module
"projection/fields/server_computed_value_field"
, the declaration forgetScvResult
should not contain within it animport(...)
that has an incorrect relative path to another module. Honestly I don't know what it's supposed to contain, but I suspect it is probably supposed to haveimport("projection/server_computed_value")
.Actual behavior:
A relative path to another module,
"../server_computed_value"
, was generated, when in fact the declaration of that other module appears later in the same d.ts file with a regular, non-relative name,"projection/server_computed_value"
. This causes my future compilations that use this d.ts file to fail.The generated
out/datastore.bundle.d.ts
file includes this:Related Issues:
This looks similar to the following other issues, which were resolved as fixed: #25358, #24599
The text was updated successfully, but these errors were encountered: