Comparing version 0.5.1-next.1 to 0.5.1-next.2
@@ -32,5 +32,8 @@ import { OmitTag } from './core/types.js'; | ||
} : { | ||
else: <ThisResult extends unknown>(value: ThisResult | ((data: ADT) => ThisResult)) => Result | ThisResult; | ||
else: <ThisResult extends unknown>(value: ThisResult | ((data: ExcludeByTag<ADT, PreviousTagsMatched>) => ThisResult)) => Result | ThisResult; | ||
}); | ||
declare type ExcludeByTag<Record extends SomeRecord, Tag extends string> = Record extends { | ||
_tag: Tag; | ||
} ? never : Record; | ||
export {}; | ||
//# sourceMappingURL=match.d.ts.map |
@@ -22,4 +22,2 @@ /* | ||
const matcherStack = []; | ||
// TODO unused | ||
const _dataMatchers = []; | ||
const tagMatchers = {}; | ||
@@ -44,3 +42,3 @@ const execute = () => { | ||
} | ||
throw new Error(`No matcher matched on the given data. This should be impossible. Are you sure the runtime is not different than the static types? Please report a bug at https://todo. The given data was:\n${inspect(algebraicDataType)}`); | ||
throw new Error(`No matcher matched on the given data. This should be impossible. Are you sure the runtime is not different than the static types? Please report a bug at https://jasonkuhrt/alge. The given data was:\n${inspect(algebraicDataType)}`); | ||
}; | ||
@@ -83,5 +81,2 @@ const proxy = new Proxy({}, { | ||
} | ||
else { | ||
_dataMatchers.push(matcher); | ||
} | ||
return proxy; | ||
@@ -88,0 +83,0 @@ }; |
{ | ||
"name": "alge", | ||
"version": "0.5.1-next.1", | ||
"version": "0.5.1-next.2", | ||
"repository": "git@github.com:jasonkuhrt/alge.git", | ||
@@ -38,3 +38,3 @@ "author": "Jason Kuhrt", | ||
"build:esm": "tsc --project tsconfig.esm.json", | ||
"test": "jest", | ||
"test": "vitest", | ||
"clean": "rm -rf dist-cjs dist-esm node_modules/.cache", | ||
@@ -52,10 +52,7 @@ "release:pr": "dripip pr", | ||
"devDependencies": { | ||
"@jest/types": "29.0.2", | ||
"@prisma-labs/prettier-config": "0.1.0", | ||
"@swc/core": "1.2.247", | ||
"@swc/helpers": "0.4.11", | ||
"@swc/jest": "0.2.22", | ||
"@tsconfig/node16": "1.0.3", | ||
"@tsconfig/recommended": "1.0.1", | ||
"@types/jest": "29.0.0", | ||
"@types/lodash.ismatch": "4.4.7", | ||
@@ -79,7 +76,2 @@ "@types/node": "17.0.39", | ||
"fs-jetpack": "^4.3.1", | ||
"jest": "29.0.2", | ||
"jest-watch-select-projects": "2.0.0", | ||
"jest-watch-suspend": "1.1.2", | ||
"jest-watch-typeahead": "2.1.1", | ||
"konn": "0.7.0", | ||
"markdown-toc": "1.2.0", | ||
@@ -89,7 +81,7 @@ "prettier": "2.7.1", | ||
"semver-utils": "1.1.4", | ||
"ts-jest": "28.0.8", | ||
"ts-node": "10.9.1", | ||
"tsd": "0.23.0", | ||
"typescript": "4.8.2" | ||
"typescript": "4.8.2", | ||
"vitest": "^0.23.1" | ||
} | ||
} |
@@ -16,3 +16,3 @@ /* | ||
import { OmitTag } from './core/types.js' | ||
import { inspect } from './lib/utils.js' | ||
import { inspect, ObjectValues } from './lib/utils.js' | ||
import { SomeRecord } from './record/types/controller.js' | ||
@@ -42,4 +42,2 @@ import isMatch from 'lodash.ismatch' | ||
const matcherStack: (DataMatcherDefinition | TagMatcherDefinition)[] = [] | ||
// TODO unused | ||
const _dataMatchers: DataMatcherDefinition[] = [] | ||
const tagMatchers: Record<string, TagMatcherDefinition> = {} | ||
@@ -65,3 +63,3 @@ | ||
throw new Error( | ||
`No matcher matched on the given data. This should be impossible. Are you sure the runtime is not different than the static types? Please report a bug at https://todo. The given data was:\n${inspect( | ||
`No matcher matched on the given data. This should be impossible. Are you sure the runtime is not different than the static types? Please report a bug at https://jasonkuhrt/alge. The given data was:\n${inspect( | ||
algebraicDataType | ||
@@ -118,4 +116,2 @@ )}` | ||
tagMatchers[property] = matcher | ||
} else { | ||
_dataMatchers.push(matcher) | ||
} | ||
@@ -158,4 +154,8 @@ return proxy | ||
} : { | ||
else: <ThisResult extends unknown>(value: ThisResult| ((data: ADT) => ThisResult)) => Result|ThisResult | ||
else: <ThisResult extends unknown>(value: ThisResult | ((data: ExcludeByTag<ADT, PreviousTagsMatched>) => ThisResult)) => Result | ThisResult | ||
} | ||
) | ||
type ExcludeByTag<Record extends SomeRecord, Tag extends string> = Record extends { _tag: Tag } | ||
? never | ||
: Record |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31
283364
2990