Improve doctests

This commit is contained in:
Pieter Vander Vennet 2022-03-25 15:47:14 +01:00
parent 9f0dd17419
commit e1c62582cb
21 changed files with 1019 additions and 1929 deletions

9
examples/OtherClass.ts Normal file
View file

@ -0,0 +1,9 @@
import SomeClass from "./someClass";
export default class OtherClass {
public doSomething(c: SomeClass){
return c.xyz()
}
}

View file

@ -1,24 +0,0 @@
export default class Example0 {
/**
* Gets the field doubled
* @example xyz
*
* // Should equal 42
* Example0.get() // => 42
*
* Example0.get() + 1 // => 43
*/
private static get(){
// a comment
// @ts-ignore
return 42
}
public testMore(){
return ({} as any) ?.xyz?.abc ?? 0
}
}

27
examples/someClass.ts Normal file
View file

@ -0,0 +1,27 @@
export default class SomeClass {
/**
* Gets the field doubled
* @example xyz
*
* import OtherClass from "./OtherClass";
*
* // Should equal 42
* SomeClass.get() // => 42
*
* SomeClass.get() + 1 // => 43
*
* new OtherClass().doSomething(new SomeClass()) // => 5
*/
private static get() : number{
// a comment
// @ts-ignore
return 42
}
public xyz(){
return 5
}
}