Skip to content

Commit d871224

Browse files
committed
WIP
1 parent 923f483 commit d871224

17 files changed

+240
-312
lines changed

snapshots/input/react/src/GenericAttribute.tsx

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { Configuration } from './object-literals-types'
1+
import { Configuration } from './reusable-types'
22

3-
function MyDecorator2(value: Configuration) {
3+
function MyDecorator(value: Configuration) {
44
return function (target: Function) {
55
console.log(`MyDecorator is called with value: ${value}`)
66
}
77
}
88

9-
@MyDecorator2({ property: 42, property2: '42' })
10-
class MyClass2 {
9+
@MyDecorator({ property: 42, property2: '42' })
10+
class MyClass {
1111
//...
1212
}

snapshots/input/syntax/src/inheritance.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1+
import { Superinterface } from './reusable-types'
12
import { Overloader } from './overload'
23

3-
export interface Superinterface {
4-
property: string
5-
interfaceMethod(): string
6-
}
7-
export interface GenericInterface<T> {
8-
property: T
9-
interfaceMethod(): string
10-
}
114
export interface IntermediateSuperinterface extends Superinterface {
125
intermediateInterfaceMethod(): string
136
}

snapshots/input/syntax/src/object-literals-arrow-function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Option } from './object-literals-types'
1+
import { Option } from './reusable-types'
22

33
interface Foobar {
44
foobar: number

snapshots/input/syntax/src/object-literals-call-signatures.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
import { GenericInterface, Superinterface } from './inheritance'
2-
import { Configuration, GenericClass, Option } from './object-literals-types'
1+
import {
2+
Configuration,
3+
GenericClass,
4+
GenericInterface,
5+
Option,
6+
Superinterface,
7+
} from './reusable-types'
38

49
export function consumesInterface(superInterface: Superinterface): void {}
510
export function consumesArray(superInterface: Superinterface[]): void {}

snapshots/input/syntax/src/object-literals-nested.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Option } from './object-literals-types'
1+
import { Option } from './reusable-types'
22

33
interface Address {
44
street: string

snapshots/input/syntax/src/object-literals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Configuration } from './object-literals-types'
1+
import { Configuration } from './reusable-types'
22

33
function random(): number {
44
return Math.random()

snapshots/input/syntax/src/object-literals-types.ts renamed to snapshots/input/syntax/src/reusable-types.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Reusable types for object-literal-* tests
1+
// Reusable types for other snapshot tests
22

33
export interface Option<A> {
44
value?: A
@@ -18,3 +18,12 @@ export class GenericClass<A> {
1818
return this.values.map(a => fn(a))
1919
}
2020
}
21+
22+
export interface Superinterface {
23+
property: string
24+
interfaceMethod(): string
25+
}
26+
export interface GenericInterface<T> {
27+
property: T
28+
interfaceMethod(): string
29+
}

snapshots/output/react/src/GenericAttribute.tsx

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { Configuration } from './object-literals-types'
1+
import { Configuration } from './reusable-types'
22
// definition syntax 1.0.0 src/`decorators.ts`/
33
//documentation ```ts\nmodule "decorators.ts"\n```
4-
// ^^^^^^^^^^^^^ reference syntax 1.0.0 src/`object-literals-types.ts`/Configuration#
5-
// ^^^^^^^^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`object-literals-types.ts`/
4+
// ^^^^^^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Configuration#
5+
// ^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/
66

7-
function MyDecorator2(value: Configuration) {
8-
// ^^^^^^^^^^^^ definition syntax 1.0.0 src/`decorators.ts`/MyDecorator2().
9-
// documentation ```ts\nfunction MyDecorator2(value: Configuration): (target: Function) => void\n```
10-
// ^^^^^ definition local 0
11-
// documentation ```ts\n(parameter) value: Configuration\n```
12-
// ^^^^^^^^^^^^^ reference syntax 1.0.0 src/`object-literals-types.ts`/Configuration#
7+
function MyDecorator(value: Configuration) {
8+
// ^^^^^^^^^^^ definition syntax 1.0.0 src/`decorators.ts`/MyDecorator().
9+
// documentation ```ts\nfunction MyDecorator(value: Configuration): (target: Function) => void\n```
10+
// ^^^^^ definition local 0
11+
// documentation ```ts\n(parameter) value: Configuration\n```
12+
// ^^^^^^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Configuration#
1313
return function (target: Function) {
1414
// ^^^^^^ definition local 1
1515
// documentation ```ts\n(parameter) target: Function\n```
@@ -28,13 +28,13 @@
2828
}
2929
}
3030

31-
@MyDecorator2({ property: 42, property2: '42' })
32-
// ^^^^^^^^^^^^ reference syntax 1.0.0 src/`decorators.ts`/MyDecorator2().
33-
// ^^^^^^^^ reference syntax 1.0.0 src/`object-literals-types.ts`/Numbers#property.
34-
// ^^^^^^^^^ reference syntax 1.0.0 src/`object-literals-types.ts`/Strings#property2.
35-
class MyClass2 {
36-
// ^^^^^^^^ definition syntax 1.0.0 src/`decorators.ts`/MyClass2#
37-
// documentation ```ts\nclass MyClass2\n```
31+
@MyDecorator({ property: 42, property2: '42' })
32+
// ^^^^^^^^^^^ reference syntax 1.0.0 src/`decorators.ts`/MyDecorator().
33+
// ^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Numbers#property.
34+
// ^^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Strings#property2.
35+
class MyClass {
36+
// ^^^^^^^ definition syntax 1.0.0 src/`decorators.ts`/MyClass#
37+
// documentation ```ts\nclass MyClass\n```
3838
//...
3939
}
4040

snapshots/output/syntax/src/inheritance.ts

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,16 @@
1-
import { Overloader } from './overload'
1+
import { Superinterface } from './reusable-types'
22
// definition syntax 1.0.0 src/`inheritance.ts`/
33
//documentation ```ts\nmodule "inheritance.ts"\n```
4+
// ^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Superinterface#
5+
// ^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/
6+
import { Overloader } from './overload'
47
// ^^^^^^^^^^ reference syntax 1.0.0 src/`overload.d.ts`/Overloader#
58
// ^^^^^^^^^^^^ reference syntax 1.0.0 src/`overload.d.ts`/
69

7-
export interface Superinterface {
8-
// ^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Superinterface#
9-
// documentation ```ts\ninterface Superinterface\n```
10-
property: string
11-
// ^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Superinterface#property.
12-
// documentation ```ts\n(property) property: string\n```
13-
interfaceMethod(): string
14-
// ^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Superinterface#interfaceMethod().
15-
// documentation ```ts\n(method) interfaceMethod() => string\n```
16-
}
17-
export interface GenericInterface<T> {
18-
// ^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/GenericInterface#
19-
// documentation ```ts\ninterface GenericInterface\n```
20-
// ^ definition syntax 1.0.0 src/`inheritance.ts`/GenericInterface#[T]
21-
// documentation ```ts\nT: T\n```
22-
property: T
23-
// ^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/GenericInterface#property.
24-
// documentation ```ts\n(property) property: T\n```
25-
// ^ reference syntax 1.0.0 src/`inheritance.ts`/GenericInterface#[T]
26-
interfaceMethod(): string
27-
// ^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/GenericInterface#interfaceMethod().
28-
// documentation ```ts\n(method) interfaceMethod() => string\n```
29-
}
3010
export interface IntermediateSuperinterface extends Superinterface {
3111
// ^^^^^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperinterface#
3212
// documentation ```ts\ninterface IntermediateSuperinterface\n```
33-
// ^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#
13+
// ^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Superinterface#
3414
intermediateInterfaceMethod(): string
3515
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperinterface#intermediateInterfaceMethod().
3616
// documentation ```ts\n(method) intermediateInterfaceMethod() => string\n```
@@ -63,8 +43,8 @@
6343
// relationship implementation scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#
6444
// relationship implementation scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperinterface#
6545
// relationship implementation scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superclass#
66-
// relationship implementation scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superinterface#
6746
// relationship implementation scip-typescript npm syntax 1.0.0 src/`overload.d.ts`/Overloader#
47+
// relationship implementation scip-typescript npm syntax 1.0.0 src/`reusable-types.ts`/Superinterface#
6848
extends IntermediateSuperclass
6949
// ^^^^^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#
7050
implements IntermediateSuperinterface, Overloader
@@ -85,7 +65,7 @@
8565
property = 'property'
8666
// ^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#property.
8767
// documentation ```ts\n(property) property: string\n```
88-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superinterface#property.
68+
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`reusable-types.ts`/Superinterface#property.
8969
public overrideMethod(): string {
9070
// ^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#overrideMethod().
9171
// documentation ```ts\n(method) overrideMethod(): string\n```
@@ -106,7 +86,7 @@
10686
public interfaceMethod(): string {
10787
// ^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#interfaceMethod().
10888
// documentation ```ts\n(method) interfaceMethod(): string\n```
109-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superinterface#interfaceMethod().
89+
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`reusable-types.ts`/Superinterface#interfaceMethod().
11090
throw new Error('Method not implemented.')
11191
// ^^^^^ reference typescript 4.8.4 lib/`lib.es5.d.ts`/Error#
11292
// ^^^^^ reference typescript 4.8.4 lib/`lib.es5.d.ts`/Error.
@@ -123,11 +103,11 @@
123103
export const objectLiteralImplementation: Superinterface = {
124104
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/objectLiteralImplementation.
125105
// documentation ```ts\nvar objectLiteralImplementation: Superinterface\n```
126-
// ^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#
106+
// ^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Superinterface#
127107
property: 'property',
128-
// ^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#property.
108+
// ^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Superinterface#property.
129109
interfaceMethod: (): string => {
130-
// ^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#interfaceMethod().
110+
// ^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Superinterface#interfaceMethod().
131111
throw new Error('Function not implemented.')
132112
// ^^^^^ reference typescript 4.8.4 lib/`lib.es5.d.ts`/Error#
133113
// ^^^^^ reference typescript 4.8.4 lib/`lib.es5.d.ts`/Error.

snapshots/output/syntax/src/object-literals-arrow-function.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Option } from './object-literals-types'
1+
import { Option } from './reusable-types'
22
// definition syntax 1.0.0 src/`object-literals-arrow-function.ts`/
33
//documentation ```ts\nmodule "object-literals-arrow-function.ts"\n```
4-
// ^^^^^^ reference syntax 1.0.0 src/`object-literals-types.ts`/Option#
5-
// ^^^^^^^^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`object-literals-types.ts`/
4+
// ^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Option#
5+
// ^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/
66

77
interface Foobar {
88
// ^^^^^^ definition syntax 1.0.0 src/`object-literals-arrow-function.ts`/Foobar#
@@ -74,15 +74,15 @@
7474
export function genericArrowOption(): Option<Foobar>[] {
7575
// ^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`object-literals-arrow-function.ts`/genericArrowOption().
7676
// documentation ```ts\nfunction genericArrowOption(): Option<Foobar>[]\n```
77-
// ^^^^^^ reference syntax 1.0.0 src/`object-literals-types.ts`/Option#
77+
// ^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Option#
7878
// ^^^^^^ reference syntax 1.0.0 src/`object-literals-arrow-function.ts`/Foobar#
7979
return [1].map<Option<Foobar>>(n => ({ value: { foobar: n + 1 } }))
8080
// ^^^ reference typescript 4.8.4 lib/`lib.es5.d.ts`/Array#map().
81-
// ^^^^^^ reference syntax 1.0.0 src/`object-literals-types.ts`/Option#
81+
// ^^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Option#
8282
// ^^^^^^ reference syntax 1.0.0 src/`object-literals-arrow-function.ts`/Foobar#
8383
// ^ definition local 8
8484
// documentation ```ts\n(parameter) n: number\n```
85-
// ^^^^^ reference syntax 1.0.0 src/`object-literals-types.ts`/Option#value.
85+
// ^^^^^ reference syntax 1.0.0 src/`reusable-types.ts`/Option#value.
8686
// ^^^^^^ reference syntax 1.0.0 src/`object-literals-arrow-function.ts`/Foobar#foobar.
8787
// ^ reference local 8
8888
}
@@ -91,6 +91,8 @@
9191
// ^^^^^^^^^^^^^ definition syntax 1.0.0 src/`object-literals-arrow-function.ts`/genericArrow2().
9292
// documentation ```ts\nfunction genericArrow2(): Foobar[]\n```
9393
// ^^^^^^ reference syntax 1.0.0 src/`object-literals-arrow-function.ts`/Foobar#
94+
// navigation to `foobar` below does not work with tsserver or scip-java
95+
// because `map` is missing an explicit `map<Foobar>` annotation.
9496
return [1].map(n => ({ foobar: n + 1 }))
9597
// ^^^ reference typescript 4.8.4 lib/`lib.es5.d.ts`/Array#map().
9698
// ^ definition local 9

0 commit comments

Comments
 (0)