From 870e397ed01aa96183bf62afbb381573c2d97512 Mon Sep 17 00:00:00 2001 From: Lexus Drumgold Date: Thu, 7 Mar 2024 02:45:07 -0500 Subject: [PATCH] feat(nodes): `NullLiteral` Signed-off-by: Lexus Drumgold --- src/nodes/__tests__/literal-null.spec-d.ts | 21 +++++++++++++++++ src/nodes/index.ts | 1 + src/nodes/literal-null.ts | 27 ++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 src/nodes/__tests__/literal-null.spec-d.ts create mode 100644 src/nodes/literal-null.ts diff --git a/src/nodes/__tests__/literal-null.spec-d.ts b/src/nodes/__tests__/literal-null.spec-d.ts new file mode 100644 index 0000000..5b99621 --- /dev/null +++ b/src/nodes/__tests__/literal-null.spec-d.ts @@ -0,0 +1,21 @@ +/** + * @file Type Tests - NullLiteral + * @module esast/nodes/tests/unit-d/NullLiteral + */ + +import type { Literal } from '@flex-development/esast' +import type TestSubject from '../literal-null' + +describe('unit-d:nodes/NullLiteral', () => { + it('should extend Literal', () => { + expectTypeOf().toMatchTypeOf() + }) + + it('should match [type: "null"]', () => { + expectTypeOf().toHaveProperty('type').toEqualTypeOf<'null'>() + }) + + it('should match [value: null]', () => { + expectTypeOf().toHaveProperty('value').toEqualTypeOf() + }) +}) diff --git a/src/nodes/index.ts b/src/nodes/index.ts index 701194f..91bc769 100644 --- a/src/nodes/index.ts +++ b/src/nodes/index.ts @@ -7,4 +7,5 @@ export type { default as Literal } from './literal' export type { default as BigIntLiteral } from './literal-bigint' export type { default as BooleanLiteral } from './literal-boolean' +export type { default as NullLiteral } from './literal-null' export type { default as Node } from './node' diff --git a/src/nodes/literal-null.ts b/src/nodes/literal-null.ts new file mode 100644 index 0000000..ffc20b7 --- /dev/null +++ b/src/nodes/literal-null.ts @@ -0,0 +1,27 @@ +/** + * @file Nodes - NullLiteral + * @module esast/nodes/NullLiteral + */ + +import type { Literal } from '@flex-development/esast' + +/** + * The value `null`. + * + * @see {@linkcode Literal} + * + * @extends {Literal} + */ +interface NullLiteral extends Literal { + /** + * Node type. + */ + type: 'null' + + /** + * Plain value. + */ + value: null +} + +export type { NullLiteral as default }