Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library > JsonNull

JsonNull type

The Rush Stack lint rules discourage usage of null. However, JSON parsers always return JavaScript's null to keep the two syntaxes consistent. When creating interfaces that describe JSON structures, use JsonNull to avoid triggering the lint rule. Do not use JsonNull for any other purpose.

Signature:

export type JsonNull = null;

Remarks

If you are designing a new JSON file format, it's a good idea to avoid null entirely. In most cases there are better representations that convey more information about an item that is unknown, omitted, or disabled.

To understand why null is deprecated, please see the @rushstack/eslint-plugin documentation here:

https://www.npmjs.com/package/@rushstack/eslint-plugin#rushstackno-null