Skip to content

Instantly share code, notes, and snippets.

View netotz's full-sized avatar
📐

Ernesto Ortiz netotz

📐
View GitHub Profile
@netotz
netotz / haltingProblem.ts
Last active November 10, 2022 17:59
Solving the halting problem using TypeScript
type AnyFunction = () => any;
/**
* Returns true if running `func()` reaches a return statement.
* Otherwise, if it loops forever, returns false.
* @author God. This function is always right.
*/
declare function doesReturn(func: AnyFunction): boolean;
function test(): void | never {