Skip to content

Commit

Permalink
feat(nodes)!: raw literals
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Jun 30, 2024
1 parent 70946ac commit bc319cc
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/nodes/__tests__/literal-bigint.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ describe('unit-d:nodes/BigIntLiteral', () => {
expectTypeOf<TestSubject>().toHaveProperty('type').toEqualTypeOf<'bigint'>()
})

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

it('should match [value: bigint]', () => {
expectTypeOf<TestSubject>().toHaveProperty('value').toEqualTypeOf<bigint>()
})
Expand Down
4 changes: 4 additions & 0 deletions src/nodes/__tests__/literal-number.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ describe('unit-d:nodes/NumberLiteral', () => {
expectTypeOf<TestSubject>().toHaveProperty('type').toEqualTypeOf<'number'>()
})

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

it('should match [value: number]', () => {
expectTypeOf<TestSubject>().toHaveProperty('value').toEqualTypeOf<number>()
})
Expand Down
4 changes: 4 additions & 0 deletions src/nodes/__tests__/literal-string.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ describe('unit-d:nodes/StringLiteral', () => {
expectTypeOf<TestSubject>().toHaveProperty('type').toEqualTypeOf<'string'>()
})

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

it('should match [value: string]', () => {
expectTypeOf<TestSubject>().toHaveProperty('value').toEqualTypeOf<string>()
})
Expand Down
5 changes: 5 additions & 0 deletions src/nodes/literal-bigint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ interface BigIntLiteral extends Literal {
*/
type: 'bigint'

/**
* Raw value.
*/
raw: string

/**
* Plain value.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/literal-boolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import type { Literal } from '@flex-development/esast'

/**
* A literal boolean value.
* A boolean value.
*
* @see {@linkcode Literal}
*
Expand Down
7 changes: 6 additions & 1 deletion src/nodes/literal-number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import type { Literal } from '@flex-development/esast'

/**
* A literal integer or floating point number.
* A number.
*
* @see {@linkcode Literal}
*
Expand All @@ -18,6 +18,11 @@ interface NumberLiteral extends Literal {
*/
type: 'number'

/**
* Raw value.
*/
raw: string

/**
* Plain value.
*/
Expand Down
2 changes: 0 additions & 2 deletions src/nodes/literal-regexp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ interface RegExpLiteral extends Literal {

/**
* Plain value.
*
* @see {@linkcode RegExp.source}
*/
value: string
}
Expand Down
7 changes: 6 additions & 1 deletion src/nodes/literal-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import type { Literal } from '@flex-development/esast'

/**
* A literal string value.
* A string.
*
* @see {@linkcode Literal}
*
Expand All @@ -18,6 +18,11 @@ interface StringLiteral extends Literal {
*/
type: 'string'

/**
* Raw value.
*/
raw: string

/**
* Plain value.
*/
Expand Down

0 comments on commit bc319cc

Please sign in to comment.