Skip to content

Commit

Permalink
feat(content): Content
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 9, 2024
1 parent 6ac3a45 commit f578b08
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const config = {
parser: '@typescript-eslint/parser',
parserOptions: {
extraFileExtensions: [],
project: ['**/tsconfig.json'],
project: ['**/tsconfig.json', '**/tsconfig.*.json'],
tsconfigRootDir: process.cwd(),
warnOnUnsupportedTypeScriptVersion: true
},
Expand Down
60 changes: 60 additions & 0 deletions src/content/__tests__/content.spec-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* @file Type Tests - Content
* @module esast/content/tests/unit-d/Content
*/

import type {
Declaration,
ExportDeclaration,
Expression,
Heritage,
LiteralValue,
ModuleDeclaration,
Pattern,
Primitive,
RootChild,
Statement
} from '@flex-development/esast'
import type TestSubject from '../content'

describe('unit-d:content/Content', () => {
it('should extract Declaration', () => {
expectTypeOf<TestSubject>().extract<Declaration>().not.toBeNever()
})

it('should extract ExportDeclaration', () => {
expectTypeOf<TestSubject>().extract<ExportDeclaration>().not.toBeNever()
})

it('should extract Expression', () => {
expectTypeOf<TestSubject>().extract<Expression>().not.toBeNever()
})

it('should extract Heritage', () => {
expectTypeOf<TestSubject>().extract<Heritage>().not.toBeNever()
})

it('should extract LiteralValue', () => {
expectTypeOf<TestSubject>().extract<LiteralValue>().not.toBeNever()
})

it('should extract ModuleDeclaration', () => {
expectTypeOf<TestSubject>().extract<ModuleDeclaration>().not.toBeNever()
})

it('should extract Pattern', () => {
expectTypeOf<TestSubject>().extract<Pattern>().not.toBeNever()
})

it('should extract Primitive', () => {
expectTypeOf<TestSubject>().extract<Primitive>().not.toBeNever()
})

it('should extract RootChild', () => {
expectTypeOf<TestSubject>().extract<RootChild>().not.toBeNever()
})

it('should extract Statement', () => {
expectTypeOf<TestSubject>().extract<Statement>().not.toBeNever()
})
})
13 changes: 13 additions & 0 deletions src/content/content.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @file Content - Content
* @module esast/content/Content
*/

import type { Heritage, Pattern, RootChild } from '@flex-development/esast'

/**
* Union of registered content model nodes.
*/
type Content = Heritage | Pattern | RootChild

export type { Content as default }
1 change: 1 addition & 0 deletions src/content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @module esast/content
*/

export type { default as Content } from './content'
export type * from './declaration'
export type * from './declaration-export'
export type * from './declaration-module'
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@
"useUnknownInCatchVariables": true,
"verbatimModuleSyntax": true
},
"exclude": ["**/coverage", "**/dist", "**/node_modules"],
"exclude": [
"**/coverage",
"**/dist",
"**/node_modules",
"__tests__/setup/index.d.mts"
],
"include": [
"**/**/*.json",
"**/**/*.mjs",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.typecheck.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"exclude": ["**/coverage", "**/dist", "**/node_modules"],
"extends": "./tsconfig.json",
"include": ["**/**.ts", "**/.*.ts"]
"files": ["__tests__/setup/index.d.mts", "vitest-env.d.ts"],
"include": ["__tests__/**/**.ts", "src/**/**.ts", "src/**/.*.ts"]
}

0 comments on commit f578b08

Please sign in to comment.