loco-cli
loco-cli copied to clipboard
Improve types
I've noticed this while writing my .locorc.ts:
import dotenv from 'dotenv'
import { Config } from 'loco-cli/types'
dotenv.config({ path: ['.env.local', '.env'] })
export const config: Config = { // <-- type raises TS error
accessKey: process.env.LOCO_ACCESS_KEY as string,
localesDir: 'src/management/i18n',
namespaces: false,
push: {
'flag-new': 'provisional',
'tag-new': process.env.npm_package_version,
'delete-absent': false,
},
}
export default config
Type '{ accessKey: string; localesDir: string; namespaces: false; push: { 'flag-new': string; 'tag-new': string | undefined; 'delete-absent': false; }; }' is missing the following properties from type 'Config': defaultLanguage, pullts(2739)
The config is copy pasted from documentation, I've only added types to the object and moved the Loco key to an .env file for project constraints.
But defaultLanguage is deprecated and both PushOptions and PullOptions have only optional keys. So it makes sense to make their respective keys in Config optional.
What do you think?
Looks good to me, what do you think @robrechtme ?
Thanks for your contribution! This is now available in v3.2.0 🚀