Skip to content

Commit

Permalink
Address reviews, consolidate code
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperAuguste committed Apr 25, 2023
1 parent fbc2707 commit f9212ac
Show file tree
Hide file tree
Showing 35 changed files with 1,479 additions and 70 deletions.
34 changes: 30 additions & 4 deletions snapshots/input/syntax/src/constructor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
export class Constructor {
constructor(public readonly property: number) {}
// export class Constructor {
// constructor(public readonly property: number) {}
// }

namespace Yay {
export class SuperConstructor {
constructor(public readonly property: number) {
}
}

export namespace Woo {
export class MyClass {
constructor() {}
}
}
}

export class SuperConstructor2 {
constructor(public readonly property: number) {
}
}

export function useConstructor(): Yay.SuperConstructor {
return new Yay.SuperConstructor(10)
}

export function useConstructor2(): SuperConstructor2 {
return new SuperConstructor2(10)
}

export function useConstructor(): Constructor {
return new Constructor(Constructor.name.length)
export function useConstructor3(): Yay.Woo.MyClass {
return new Yay.Woo.MyClass()
}
8 changes: 8 additions & 0 deletions snapshots/output/invalid-package-json/packages/a/src/a.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export function a(): string {
// definition @example/a HEAD src/`a.ts`/
//documentation ```ts\nmodule "a.ts"\n```
// ^ definition @example/a HEAD src/`a.ts`/a().
// documentation ```ts\nfunction a(): string\n```
return ''
}

8 changes: 8 additions & 0 deletions snapshots/output/multi-project/packages/a/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export function a(): string {
// definition @example/a 1.0.0 src/`index.ts`/
//documentation ```ts\nmodule "index.ts"\n```
// ^ definition @example/a 1.0.0 src/`index.ts`/a().
// documentation ```ts\nfunction a(): string\n```
return ''
}

13 changes: 13 additions & 0 deletions snapshots/output/multi-project/packages/b/src/b.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { a } from '@example/a/src'
// definition @example/b 1.0.0 src/`b.ts`/
//documentation ```ts\nmodule "b.ts"\n```
// ^ reference @example/a 1.0.0 src/`index.ts`/a().
// ^^^^^^^^^^^^^^^^ reference @example/a 1.0.0 src/`index.ts`/

export function b() {
// ^ definition @example/b 1.0.0 src/`b.ts`/b().
// documentation ```ts\nfunction b(): string\n```
return a()
// ^ reference @example/a 1.0.0 src/`index.ts`/a().
}

8 changes: 8 additions & 0 deletions snapshots/output/pnpm-workspaces/packages/a/src/a.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export function a(): string {
// definition @example/a 1.0.0 src/`a.ts`/
//documentation ```ts\nmodule "a.ts"\n```
// ^ definition @example/a 1.0.0 src/`a.ts`/a().
// documentation ```ts\nfunction a(): string\n```
return ''
}

12 changes: 12 additions & 0 deletions snapshots/output/pnpm-workspaces/packages/b/src/b.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { a } from '@example/a'
// definition @example/b 1.0.0 src/`b.ts`/
//documentation ```ts\nmodule "b.ts"\n```
// ^ reference local 0

export function b() {
// ^ definition @example/b 1.0.0 src/`b.ts`/b().
// documentation ```ts\nfunction b(): any\n```
return a()
// ^ reference local 0
}

68 changes: 68 additions & 0 deletions snapshots/output/react/src/LoaderInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React from 'react'
// definition react-example 1.0.0 src/`LoaderInput.tsx`/
//documentation ```ts\nmodule "LoaderInput.tsx"\n```
// ^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/
// ^^^^^^^ reference @types/react 17.0.52 `index.d.ts`/

/** Takes loading prop, input component as child */
interface Props {
// ^^^^^ definition react-example 1.0.0 src/`LoaderInput.tsx`/Props#
// documentation ```ts\ninterface Props\n```
// documentation Takes loading prop, input component as child
loading: boolean
// ^^^^^^^ definition react-example 1.0.0 src/`LoaderInput.tsx`/Props#loading.
// documentation ```ts\n(property) loading: boolean\n```
children: React.ReactNode
// ^^^^^^^^ definition react-example 1.0.0 src/`LoaderInput.tsx`/Props#children.
// documentation ```ts\n(property) children: ReactNode\n```
// ^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/
// ^^^^^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/ReactNode#
}

export const LoaderInput: React.FunctionComponent<Props> = ({
// ^^^^^^^^^^^ definition react-example 1.0.0 src/`LoaderInput.tsx`/LoaderInput.
// documentation ```ts\nvar LoaderInput: FunctionComponent<Props>\n```
// ^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/
// ^^^^^^^^^^^^^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/FunctionComponent#
// ^^^^^ reference react-example 1.0.0 src/`LoaderInput.tsx`/Props#
loading,
// ^^^^^^^ definition local 3
// documentation ```ts\n(parameter) loading: boolean\n```
// ^^^^^^^ reference react-example 1.0.0 src/`LoaderInput.tsx`/Props#loading.
children,
// ^^^^^^^^ definition local 4
// documentation ```ts\n(parameter) children: ReactNode\n```
// ^^^^^^^^ reference react-example 1.0.0 src/`LoaderInput.tsx`/Props#children.
// ^^^^^^^^ reference local 7
}) => (
<div className="hello">
// ^^^ reference @types/react 17.0.52 `index.d.ts`/global/JSX/IntrinsicElements#div.
// ^^^^^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/HTMLAttributes#className.
{children}
// ^^^^^^^^ reference local 4
{loading && <p>spinner</p>}
// ^^^^^^^ reference local 3
// ^ reference @types/react 17.0.52 `index.d.ts`/global/JSX/IntrinsicElements#p.
// ^ reference @types/react 17.0.52 `index.d.ts`/global/JSX/IntrinsicElements#p.
</div>
// ^^^ reference @types/react 17.0.52 `index.d.ts`/global/JSX/IntrinsicElements#div.
)

export const LoaderInput2: React.FunctionComponent<Props> = props => {
// ^^^^^^^^^^^^ definition react-example 1.0.0 src/`LoaderInput.tsx`/LoaderInput2.
// documentation ```ts\nvar LoaderInput2: FunctionComponent<Props>\n```
// ^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/
// ^^^^^^^^^^^^^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/FunctionComponent#
// ^^^^^ reference react-example 1.0.0 src/`LoaderInput.tsx`/Props#
// ^^^^^ definition local 9
// documentation ```ts\n(parameter) props: PropsWithChildren<Props>\n```
return <LoaderInput loading={true} key="key" children={props.children} />
// ^^^^^^^^^^^ reference react-example 1.0.0 src/`LoaderInput.tsx`/LoaderInput.
// ^^^^^^^ reference react-example 1.0.0 src/`LoaderInput.tsx`/Props#loading.
// ^^^ reference local 13
// ^^^^^^^^ reference react-example 1.0.0 src/`LoaderInput.tsx`/Props#children.
// ^^^^^ reference local 9
// ^^^^^^^^ reference react-example 1.0.0 src/`LoaderInput.tsx`/Props#children.
// ^^^^^^^^ reference local 7
}

18 changes: 18 additions & 0 deletions snapshots/output/react/src/MyTSXElement.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
// definition react-example 1.0.0 src/`MyTSXElement.tsx`/
//documentation ```ts\nmodule "MyTSXElement.tsx"\n```
// ^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/
// ^^^^^^^ reference @types/react 17.0.52 `index.d.ts`/

export interface MyProps {}
// ^^^^^^^ definition react-example 1.0.0 src/`MyTSXElement.tsx`/MyProps#
// documentation ```ts\ninterface MyProps\n```

export const MyTSXElement: React.FunctionComponent<MyProps> = ({}) => (<p></p>)
// ^^^^^^^^^^^^ definition react-example 1.0.0 src/`MyTSXElement.tsx`/MyTSXElement.
// documentation ```ts\nvar MyTSXElement: FunctionComponent<MyProps>\n```
// ^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/
// ^^^^^^^^^^^^^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/FunctionComponent#
// ^^^^^^^ reference react-example 1.0.0 src/`MyTSXElement.tsx`/MyProps#
// ^ reference @types/react 17.0.52 `index.d.ts`/global/JSX/IntrinsicElements#p.
// ^ reference @types/react 17.0.52 `index.d.ts`/global/JSX/IntrinsicElements#p.
20 changes: 20 additions & 0 deletions snapshots/output/react/src/UseMyTSXElement.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
// definition react-example 1.0.0 src/`UseMyTSXElement.tsx`/
//documentation ```ts\nmodule "UseMyTSXElement.tsx"\n```
// ^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/
// ^^^^^^^ reference @types/react 17.0.52 `index.d.ts`/

import { MyProps, MyTSXElement } from "./MyTSXElement";
// ^^^^^^^ reference react-example 1.0.0 src/`MyTSXElement.tsx`/MyProps#
// ^^^^^^^^^^^^ reference react-example 1.0.0 src/`MyTSXElement.tsx`/MyTSXElement.
// ^^^^^^^^^^^^^^^^ reference react-example 1.0.0 src/`MyTSXElement.tsx`/

export const _: React.FunctionComponent<MyProps> =
// ^ definition react-example 1.0.0 src/`UseMyTSXElement.tsx`/_.
// documentation ```ts\nvar _: FunctionComponent<MyProps>\n```
// ^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/
// ^^^^^^^^^^^^^^^^^ reference @types/react 17.0.52 `index.d.ts`/React/FunctionComponent#
// ^^^^^^^ reference react-example 1.0.0 src/`MyTSXElement.tsx`/MyProps#
({}) => (<MyTSXElement></MyTSXElement>)
// ^^^^^^^^^^^^ reference react-example 1.0.0 src/`MyTSXElement.tsx`/MyTSXElement.
// ^^^^^^^^^^^^ reference react-example 1.0.0 src/`MyTSXElement.tsx`/MyTSXElement.
54 changes: 54 additions & 0 deletions snapshots/output/syntax/src/ClassWithPrivate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
export class ClassWithPrivate {
// definition syntax 1.0.0 src/`ClassWithPrivate.ts`/
//documentation ```ts\nmodule "ClassWithPrivate.ts"\n```
// ^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#
// documentation ```ts\nclass ClassWithPrivate\n```
#privateField
// ^^^^^^^^^^^^^ definition syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateField`.
// documentation ```ts\n(property) #privateField: any\n```
#privateFieldWithInitializer = 42
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateFieldWithInitializer`.
// documentation ```ts\n(property) #privateFieldWithInitializer: number\n```

#privateMethod() {
// ^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateMethod`().
// documentation ```ts\n(method) #privateMethod(): any\n```
this.#privateField = 'private field'
// ^^^^^^^^^^^^^ reference syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateField`.
return this.#privateField
// ^^^^^^^^^^^^^ reference syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateField`.
}

static #privateStaticField
// ^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateStaticField`.
// documentation ```ts\n(property) #privateStaticField: any\n```
static #privateStaticFieldWithInitializer = 42
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateStaticFieldWithInitializer`.
// documentation ```ts\n(property) #privateStaticFieldWithInitializer: number\n```

static #privateStaticMethod() {}
// ^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateStaticMethod`().
// documentation ```ts\n(method) #privateStaticMethod(): void\n```
public publicMethod(): any[] {
// ^^^^^^^^^^^^ definition syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#publicMethod().
// documentation ```ts\n(method) publicMethod(): any[]\n```
return [
this.#privateField,
// ^^^^^^^^^^^^^ reference syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateField`.
this.#privateFieldWithInitializer,
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateFieldWithInitializer`.
this.#privateMethod(),
// ^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateMethod`().
ClassWithPrivate.#privateStaticMethod(),
// ^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#
// ^^^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateStaticMethod`().
ClassWithPrivate.#privateStaticField,
// ^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#
// ^^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateStaticField`.
ClassWithPrivate.#privateStaticFieldWithInitializer,
// ^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`ClassWithPrivate.ts`/ClassWithPrivate#`#privateStaticFieldWithInitializer`.
]
}
}

Loading

0 comments on commit f9212ac

Please sign in to comment.