Skip to content

Commit

Permalink
feat(nodes): NullLiteral
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Mar 7, 2024
1 parent 73de415 commit 870e397
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/nodes/__tests__/literal-null.spec-d.ts
Original file line number Diff line number Diff line change
@@ -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<TestSubject>().toMatchTypeOf<Literal>()
})

it('should match [type: "null"]', () => {
expectTypeOf<TestSubject>().toHaveProperty('type').toEqualTypeOf<'null'>()
})

it('should match [value: null]', () => {
expectTypeOf<TestSubject>().toHaveProperty('value').toEqualTypeOf<null>()
})
})
1 change: 1 addition & 0 deletions src/nodes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
27 changes: 27 additions & 0 deletions src/nodes/literal-null.ts
Original file line number Diff line number Diff line change
@@ -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 }

0 comments on commit 870e397

Please sign in to comment.