Search code examples
ngx-mask

error TS2322: Type 'null' is not assignable to type 'Partial<IConfig> | (() => Partial<IConfig>)'


Installed and followed Quickstart instructions of ngx-mask for app.module.ts:

import { NgxMaskModule, IConfig } from 'ngx-mask'

export const options: Partial<IConfig> | (() => Partial<IConfig>) = null;

@NgModule({
  imports: [
    NgxMaskModule.forRoot(),
  ],
})

ng serve returns

error TS2322: Type 'null' is not assignable to type 'Partial | (() => Partial)'.

enter image description here

Angular v14, node 14.19


Solution

  • Solution: Partial<IConfig> --> Partial<null|IConfig>