Skip to content

Commit

Permalink
Fixes 475 issue where some users reported errors exporting entities a…
Browse files Browse the repository at this point in the history
…nd/or types when using the `CustomAttributeType` function. They would receive an error similar to `Exported variable '...' has or is using name 'OpaquePrimitiveSymbol' from external module "..." but cannot be named.` (#477)
  • Loading branch information
tywalch authored Feb 18, 2025
1 parent 2ff64b5 commit 393f8fc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,4 +575,8 @@ All notable changes to this project will be documented in this file. Breaking ch

## [3.4.0]
### Added
- [Issue #416](https://github.com/tywalch/electrodb/issues/416); You can now use reverse indexes without the use of `template`.
- [Issue #416](https://github.com/tywalch/electrodb/issues/416); You can now use reverse indexes without the use of `template`.

## [3.4.1]
### Fixed
- [Issue #475](https://github.com/tywalch/electrodb/issues/475); Fixes issue where some users reported errors exporting entities and/or types when using the `CustomAttributeType` function. They would receive an error similar to `Exported variable '...' has or is using name 'OpaquePrimitiveSymbol' from external module "..." but cannot be named.`.
16 changes: 11 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3564,15 +3564,21 @@ export interface NumberSetAttribute {
readonly watch?: ReadonlyArray<string> | "*";
}

type CustomAttributeTypeName<T> = { readonly [CustomAttributeSymbol]: T };
interface CustomAttributeTypeName<T> {
readonly [CustomAttributeSymbol]: T;
}

interface CustomPrimitiveTypeName<T> {
readonly [OpaquePrimitiveSymbol]: T;
}

type OpaquePrimitiveTypeName<T extends string | number | boolean> =
export type OpaquePrimitiveTypeName<T extends string | number | boolean> =
T extends string
? "string" & { readonly [OpaquePrimitiveSymbol]: T }
? "string" & CustomPrimitiveTypeName<T>
: T extends number
? "number" & { readonly [OpaquePrimitiveSymbol]: T }
? "number" & CustomPrimitiveTypeName<T>
: T extends boolean
? "boolean" & { readonly [OpaquePrimitiveSymbol]: T }
? "boolean" & CustomPrimitiveTypeName<T>
: never;

type CustomAttribute = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electrodb",
"version": "3.4.0",
"version": "3.4.1",
"description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 393f8fc

Please sign in to comment.