-
Notifications
You must be signed in to change notification settings - Fork 645
Ensure nodes have real parents, fix parent race #970
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
Changes from 3 commits
d007a4a
e976bb0
ad3ab5d
3551e55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
index.js(2,28): error TS2304: Cannot find name 'B'. | ||
index.js(2,42): error TS2304: Cannot find name 'A'. | ||
index.js(2,48): error TS2304: Cannot find name 'B'. | ||
index.js(2,67): error TS2304: Cannot find name 'B'. | ||
|
||
|
||
==== index.js (4 errors) ==== | ||
/** | ||
* @typedef {{ [K in keyof B]: { fn: (a: A, b: B) => void; thing: B[K]; } }} Funcs | ||
~ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my best guess is that the something set the type expression parents to the synthetic type alias, inconsistent with other type expressions, and the binder change now makes it consistent with the others. I have a branch that sets Edit:actually it may be that all type aliases were working by mistake? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually it may be that all typedefs were setting their type's parent to the synthetic node. Not in the reparser, though, so through the binder's existing code. |
||
!!! error TS2304: Cannot find name 'B'. | ||
~ | ||
!!! error TS2304: Cannot find name 'A'. | ||
~ | ||
!!! error TS2304: Cannot find name 'B'. | ||
~ | ||
!!! error TS2304: Cannot find name 'B'. | ||
* @template A | ||
* @template {Record<string, unknown>} B | ||
*/ | ||
|
||
/** | ||
* @template A | ||
* @template {Record<string, unknown>} B | ||
* @param {Funcs<A, B>} fns | ||
* @returns {[A, B]} | ||
*/ | ||
function foo(fns) { | ||
return /** @type {any} */ (null); | ||
} | ||
|
||
const result = foo({ | ||
bar: { | ||
fn: | ||
/** @param {string} a */ | ||
(a) => {}, | ||
thing: "asd", | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
b.js(8,12): error TS4078: Parameter 'a' of exported function has or is using private name 'Foo'. | ||
|
||
|
||
==== a.ts (0 errors) ==== | ||
export interface Foo {} | ||
|
||
==== b.js (1 errors) ==== | ||
/** | ||
* @import { | ||
* Foo | ||
* } from "./a" | ||
*/ | ||
|
||
/** | ||
* @param {Foo} a | ||
~~~ | ||
!!! error TS4078: Parameter 'a' of exported function has or is using private name 'Foo'. | ||
*/ | ||
export function foo(a) {} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
b.js(7,12): error TS4078: Parameter 'a' of exported function has or is using private name 'Foo'. | ||
|
||
|
||
==== a.ts (0 errors) ==== | ||
export interface Foo {} | ||
|
||
==== b.js (1 errors) ==== | ||
/** | ||
* @import { Foo } | ||
* from "./a" | ||
*/ | ||
|
||
/** | ||
* @param {Foo} a | ||
~~~ | ||
!!! error TS4078: Parameter 'a' of exported function has or is using private name 'Foo'. | ||
*/ | ||
export function foo(a) {} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
b.js(8,12): error TS4078: Parameter 'a' of exported function has or is using private name 'Foo'. | ||
|
||
|
||
==== a.ts (0 errors) ==== | ||
export interface Foo {} | ||
|
||
==== b.js (1 errors) ==== | ||
/** | ||
* @import | ||
* { Foo | ||
* } from './a' | ||
*/ | ||
|
||
/** | ||
* @param {Foo} a | ||
~~~ | ||
!!! error TS4078: Parameter 'a' of exported function has or is using private name 'Foo'. | ||
*/ | ||
export function foo(a) {} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/foo.js(6,13): error TS4078: Parameter 'foo' of exported function has or is using private name 'Foo'. | ||
|
||
|
||
==== /types.ts (0 errors) ==== | ||
export interface Foo { | ||
a: number; | ||
} | ||
|
||
==== /foo.js (1 errors) ==== | ||
/** | ||
* @import { Foo } from "./types" | ||
*/ | ||
|
||
/** | ||
* @param { Foo } foo | ||
~~~ | ||
!!! error TS4078: Parameter 'foo' of exported function has or is using private name 'Foo'. | ||
*/ | ||
function f(foo) {} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,22 +30,22 @@ module.exports = Timer; | |
* @param {HookHandler} handle | ||
*/ | ||
function Hook(handle) { | ||
>Hook : (handle: HookHandler) => void | ||
>handle : HookHandler | ||
>Hook : (handle: (arg: any) => void) => void | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the main different effect of this alternate-parent technique is that symbols no longer print as aliases. I'll need to figure out why when I start burning down the jsdoc diffs. |
||
>handle : (arg: any) => void | ||
|
||
this.handle = handle; | ||
>this.handle = handle : HookHandler | ||
>this.handle = handle : (arg: any) => void | ||
>this.handle : any | ||
>this : any | ||
>handle : any | ||
>handle : HookHandler | ||
>handle : (arg: any) => void | ||
} | ||
module.exports = Hook; | ||
>module.exports = Hook : (handle: HookHandler) => void | ||
>module.exports : (handle: HookHandler) => void | ||
>module : { Hook(handle: HookHandler): void; } | ||
>exports : (handle: HookHandler) => void | ||
>Hook : (handle: HookHandler) => void | ||
>module.exports = Hook : (handle: (arg: any) => void) => void | ||
>module.exports : (handle: (arg: any) => void) => void | ||
>module : { Hook(handle: (arg: any) => void): void; } | ||
>exports : (handle: (arg: any) => void) => void | ||
>Hook : (handle: (arg: any) => void) => void | ||
|
||
=== context.js === | ||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
templateTagOnConstructorFunctions.js(3,18): error TS2304: Cannot find name 'U'. | ||
templateTagOnConstructorFunctions.js(3,24): error TS2304: Cannot find name 'U'. | ||
|
||
|
||
==== templateTagOnConstructorFunctions.js (2 errors) ==== | ||
/** | ||
* @template U | ||
* @typedef {(u: U) => U} Id | ||
~ | ||
!!! error TS2304: Cannot find name 'U'. | ||
~ | ||
!!! error TS2304: Cannot find name 'U'. | ||
*/ | ||
/** | ||
* @param {T} t | ||
* @template T | ||
*/ | ||
function Zet(t) { | ||
/** @type {T} */ | ||
this.u | ||
this.t = t | ||
} | ||
/** | ||
* @param {T} v | ||
* @param {Id<T>} id | ||
*/ | ||
Zet.prototype.add = function(v, id) { | ||
this.u = v || this.t | ||
return id(this.u) | ||
} | ||
var z = new Zet(1) | ||
z.t = 2 | ||
z.u = false | ||
|
Uh oh!
There was an error while loading. Please reload this page.