1.2.4 • Published 4 years ago
unimpl v1.2.4
unimpl
- TypeScript
todo()
,unimplemented()
andunreachable()
functions - Inspired by Rust
todo!()
,unimplemented!()
andunreachable!()
macros - Can develop a project without type check errors
Install
npm i unimpl
Usage
import { todo, unimplemented, unreachable } from 'unimpl';
function function1(): string {
const needToImplement = true;
if (needToImplement) {
return todo(); // Throws an error 'Not yet implemented'
}
}
function function2(): string {
const needToImplement = true;
if (needToImplement) {
return unimplemented(); // Throws an error 'Not implemented'
}
}
function function3(): string {
const needToExit = true;
if (needToExit) {
return 'Exit function here';
}
return unreachable(); // Throws an error 'Internal error: entered unreachable code'
}