-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Poor error message when names conflict #32231
Comments
🐞 |
What version of lodash is this? |
repros with |
Starting failing this way in 2.6. |
I have same error: after migration from 3.5.3 to 3.7.4. |
@sandersn I think I've figured out why this error happens, at least in my code. /**
* @typedef (Object) CustomProps
* @property (Boolean) visible
* @property (children:React.ReactNode) children
*
* @param {CustomProps} props
*/
const SomeComponent=(props)=><div>Hello</div>; As you see, there is invalid JSDoc syntax. // d.kind = 75, SyntaxKind.Identifier
return ts.Debug.failBadSyntaxKind(d) After JSDoc code was fixed, the error is gone. |
I'm getting a similar error, though not speicific to lodash:
How do I even start to debug this? |
@joeprivettsmart If you can get this caught in the debugger, you can probably find a SourceFile object somewhere in the stack and inspect its name. Basically, The alternative is "binary debugging", in which you delete half of your files at a time to see which ones had the bad node. Either way, I'm pretty sure it's in a file with decorators because that's serializeTypeNode says that it converts type nodes to their equivalent runtime types. It would be a good idea to open a new bug while you're at it, because your stack is quite different from the original one. |
The test case for the original issue reported by @OliverJAsh here: // @strict: true
// @noEmit: true
// @filename: node_modules/@types/lodash/object.d.ts
import _ = require("./index");
declare module "./index" {
interface LoDashStatic {
pick<T extends object, U extends keyof T>(
object: T,
...props: Array<U>
): Pick<T, U>;
}
}
// @filename: node_modules/@types/lodash/pick.d.ts
import { pick } from "./index";
export = pick;
// @filename: node_modules/@types/lodash/index.d.ts
/// <reference path="./object.d.ts" />
export = _;
export as namespace _;
declare const _: _.LoDashStatic;
declare namespace _ {
interface LoDashStatic {}
}
// @filename: index.ts
import * as pick from 'lodash/pick';
export const pick = () => pick(); |
TypeScript Version: 3.5.2
Search Terms: debug failure unexpected node error message exception
Obviously the following code is incorrect, however I would expect a friendly error message directing the user to the problem, rather than the nasty/ambiguous error message that is currently given:
Error: Debug Failure. Unexpected node
.I ran into this in a large codebase and it took me awhile to find source of the problem.
Code
The text was updated successfully, but these errors were encountered: