Skip to content

Commit

Permalink
fix: avoid exposing t namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Sep 6, 2022
1 parent a06381e commit 507a589
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/database/check.ts
Expand Up @@ -6,7 +6,8 @@ import {
} from './expression'
import { Query } from './query'
import { tokenizeCheck, tokenizeExpression } from './tokenize'
import { Input, isBoolExpression, t, Type } from './type'
import { Input, isBoolExpression, Type } from './type'
import { t } from './type-builtin'

interface Props extends ExpressionProps {
type: 'bool'
Expand Down
3 changes: 2 additions & 1 deletion src/database/column.ts
Expand Up @@ -5,7 +5,8 @@ import { Selectable } from './query/select'
import { kColumnFrom, kColumnName, kPrimaryKey } from './symbols'
import { RowType, toTableName } from './table'
import { tokenizeColumn } from './tokenize'
import { Input, t, Type } from './type'
import { Input, Type } from './type'
import { t } from './type-builtin'

export type ColumnOf<T> = string & keyof RowType<T>

Expand Down
2 changes: 1 addition & 1 deletion src/database/expression.ts
Expand Up @@ -3,12 +3,12 @@ import { kExprProps, kExprTokens } from './symbols'
import type { TokenProducer } from './token'
import type {
SetType,
t,
toDownCasts,
toRuntimeType,
toTypeName,
Type,
} from './type'
import { t } from './type-builtin'

/**
* This list is non-exhaustive. \
Expand Down
3 changes: 2 additions & 1 deletion src/database/is.ts
@@ -1,6 +1,7 @@
import { CheckBuilder, CheckList } from './check'
import { BoolExpression, Expression } from './expression'
import { isBoolExpression, t, Type } from './type'
import { isBoolExpression, Type } from './type'
import { t } from './type-builtin'

export function is(left: BoolExpression): CheckList<t.bool>
export function is(
Expand Down
3 changes: 2 additions & 1 deletion src/database/query/where.ts
Expand Up @@ -9,7 +9,8 @@ import { Selection } from '../selection'
import { getSetAlias, SetRef } from '../set'
import { kPrimaryKey, kTableName } from '../symbols'
import { PrimaryKeyOf, RowType, TableRef, toTableRef } from '../table'
import { t, Type } from '../type'
import { Type } from '../type'
import { t } from '../type-builtin'
import { Selectable } from './select'

export function where<From extends Selectable[]>(
Expand Down
8 changes: 8 additions & 0 deletions src/database/type-builtin.d.ts
@@ -0,0 +1,8 @@
import type { Type } from './type'

export declare namespace t {
export type bool = Type<'bool', boolean>

type NULL = Type<'null', undefined>
export { NULL as null }
}
6 changes: 0 additions & 6 deletions src/database/type-builtin.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/database/type.ts
Expand Up @@ -3,9 +3,6 @@ import type { BoolExpression, Expression, SetExpression } from './expression'
import type { Selection } from './selection'
import { kColumnFrom, kExprProps, kSelectionFrom, kTableName } from './symbols'
import type { TableRef } from './table'
import * as t from './type-builtin'

export type { t }

const kTypeName = Symbol()
const kRuntimeType = Symbol()
Expand Down

0 comments on commit 507a589

Please sign in to comment.