gluegun
gluegun copied to clipboard
TypeScript strictNullChecks: true doesn't like GluegunToolbox
Our GluegunToolbox (aka GluegunRunContext) has many optional properties that hold extensions.
export interface GluegunToolbox {
// known extensions
filesystem?: GluegunFilesystem
http?: GluegunHttp
meta?: GluegunMeta
patching?: GluegunPatching
print?: GluegunPrint
prompt?: GluegunPrompt
semver?: GluegunSemver
strings?: GluegunStrings
system?: GluegunSystem
template?: GluegunTemplate
generate?: any
If you turn on strictNullChecks
in TypeScript, TypeScript will complain about every tool you use.
const { print } = toolbox
print.info('hello')
error TS2532: Object is possibly 'undefined'.
This would require people to either turn off strictNullChecks
or build their own toolbox, which is what I'm going to recommend for Solidarity. Here's the PR: https://github.com/infinitered/solidarity/pull/177
I would like to bring it up for discussion here, though, since this could affect other Gluegun-powered TypeScript CLIs in the future.