Organizing Types
Documentation
The
greeter
object can log to a file or display an alert. You can provide LogOptions to.log(...)
and alert options to.alert(...)
Code
const g = new Greeter("Hello"); g.log({ verbose: true }); g.alert({ modal: false, title: "Current Greeting" });
Declaration
Use namespaces to organize types.
declare namespace GreetingLib { interface LogOptions { verbose?: boolean; } interface AlertOptions { modal: boolean; title?: string; color?: string; } }
You can also created nested namespaces in one declaration:
declare namespace GreetingLib.Options { // Refer to via GreetingLib.Options.Log interface Log { verbose?: boolean; } interface Alert { modal: boolean; title?: string; color?: string; } }
Please login to continue.