From a89c056a9d8a6af927e327acd9e3d6576abe27d7 Mon Sep 17 00:00:00 2001 From: Tina Chen Date: Tue, 27 Nov 2018 11:46:28 -0800 Subject: [PATCH 1/2] Random changes for testing type definition --- src/controllers/api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/api.ts b/src/controllers/api.ts index 364d17c8..d5101015 100644 --- a/src/controllers/api.ts +++ b/src/controllers/api.ts @@ -12,7 +12,7 @@ import { Response, Request, NextFunction } from "express"; */ export let getApi = (req: Request, res: Response) => { res.render("api/index", { - title: "API Examples" + title: "API Example" }); }; @@ -22,7 +22,7 @@ export let getApi = (req: Request, res: Response) => { */ export let getFacebook = (req: Request, res: Response, next: NextFunction) => { const token = req.user.tokens.find((token: any) => token.kind === "facebook"); - graph.setAccessToken(token.accessToken); + graph.setAccessToken(null); graph.get(`${req.user.facebook}?fields=id,name,email,first_name,last_name,gender,link,locale,timezone`, (err: Error, results: graph.FacebookUser) => { if (err) { return next(err); } res.render("api/facebook", { From 9a4ddbc4b7235461c9e5d179dd4c288c81dd0a94 Mon Sep 17 00:00:00 2001 From: Tina Chen Date: Tue, 27 Nov 2018 15:34:27 -0800 Subject: [PATCH 2/2] added test.ts --- src/test.ts | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 src/test.ts diff --git a/src/test.ts b/src/test.ts new file mode 100644 index 00000000..e582c40f --- /dev/null +++ b/src/test.ts @@ -0,0 +1,164 @@ +function foo() { + let x: string = 10; +} + + function foo(x: number): number; + function foo(x: string): string; + function foo(x: number | string): number | string { + return undefined; + } + + foo(10); + foo('dirk'); + + + function foo() { + let x: string = 10; + } + + function bar() { + foo(); + } + + +class A { + private foo(x: number): number; + private foo(x: string): string; + private foo(x: string | number): any { + return undefined; + } + + private bar() { + this.foo(10); + this.foo(20); + } + + + +interface I { + foo(): void; +} + +interface II { + foo(): void; +} + +class A implements I { + foo(): void { + let x: string = 10; + } +} + +class B implements I, II { + foo(): void { + } +} + +let i: I; +i.foo(); + +let b: B; +b.foo(); + + + +class T { + foo(x: number): number; + foo(x: string): string; + foo(x: string | number): string | number { + return undefined; + } +} + +function main() { + let t: T; + t.foo('hello'); + t.foo(10); +} + + + +function foo(x: number): number; +function foo(x: string): string; +function foo(x: string | number): string | number { + return undefined; +} + +foo(10); +foo('dirk'); + + + + function foo() { + } + + + +namespace I { + export interface X { + foo(x: string): number; + } +} + +interface I { +} + +class A implements I, I.X { + foo(x: string): number; + foo(x: number): number; + foo(x: string | number): number { + return 10; + } + + bar(): void { + this.foo('dirk'); + } +} + +function bar(): string { + return 'dirk'; +} + + + namespace I { + + } + + interface I { + foo(x: string | number): void; + } + + interface II extends I { + foo(x: string | number): void; + } + + interface I { + barOne(); + } + + class A implements II { + foo(x: number): void; + foo(x: string): void; + foo(x: string | number): void { + } + + barOne() { + this.foo('string'); + } + + barTwo() { + this.foo(10); + } + } + + class B extends A { + foo(x: string | number): void { + } + + barThree() { + this.foo(10); + } + + barFour(a) { + } + } \ No newline at end of file