Skip to content

Commit

Permalink
excludes observables in inputsType
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed May 22, 2023
1 parent f890b76 commit 06a4fc0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "element-vir",
"version": "12.5.3",
"version": "12.5.4",
"keywords": [
"custom",
"web",
Expand Down Expand Up @@ -31,7 +31,7 @@
"publish": "virmator publish \"npm run compile && npm run test:all\"",
"start": "npm install && virmator frontend",
"test": "virmator test-web",
"test:all": "npm run test:types && npm run test:coverage && npm run test:spelling && npm run test:format && npm run test:docs",
"test:all": "concurrently -c auto --kill-others-on-fail --colors \"npm run test:types\" \"npm run test:coverage\" \"npm run test:spelling\" \"npm run test:format\" \"npm run test:docs\"",
"test:coverage": "virmator test-web coverage",
"test:docs": "virmator code-in-markdown check",
"test:format": "virmator format check",
Expand All @@ -55,6 +55,7 @@
"@web/test-runner-playwright": "^0.10.0",
"@web/test-runner-visual-regression": "^0.8.0",
"ansi-colors": "^4.1.3",
"concurrently": "^8.0.1",
"cspell": "^6.31.1",
"esbuild": "^0.17.19",
"istanbul-smart-text-reporter": "^1.1.1",
Expand Down
18 changes: 18 additions & 0 deletions src/declarative-element/declarative-element.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {assertTypeOf} from '@augment-vir/browser-testing';
import {StaticDeclarativeElementProperties} from './declarative-element';

describe('StaticDeclarativeElementProperties', () => {
it('excludes observables in inputsType', () => {
assertTypeOf<
StaticDeclarativeElementProperties<
any,
{hi: number},
any,
any,
any,
any,
any
>['inputsType']
>().toEqualTypeOf<Readonly<{hi: number}>>();
});
});
4 changes: 2 additions & 2 deletions src/declarative-element/declarative-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {EventDescriptorMap, EventsInitMap} from './properties/element-events';
import {ElementPropertyDescriptorMap, PropertyInitMapBase} from './properties/element-properties';
import {HostClassNamesMap} from './properties/host-classes';
import {
AllowObservablePropertySetter,
FlattenObservablePropertyGetters,
FlattenObservablePropertySetters,
ObservablePropertyHandlerMap,
} from './properties/observable-property/observable-property-handler';
import {RenderCallback, RenderParams} from './render-callback';
Expand Down Expand Up @@ -261,7 +261,7 @@ export interface StaticDeclarativeElementProperties<
>,
'stateInit' | 'events'
>;
inputsType: Readonly<AllowObservablePropertySetter<InputsGeneric>>;
inputsType: Readonly<FlattenObservablePropertySetters<InputsGeneric>>;
stateType: Readonly<FlattenObservablePropertyGetters<StateInitGeneric>>;
isStrictInstance: (
element: unknown,
Expand Down
2 changes: 1 addition & 1 deletion src/declarative-element/directives/assign.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function assign<DeclarativeElementGeneric extends ElementDefinitionWithIn
declarativeElement: DeclarativeElementGeneric,
inputsObject: {} extends Required<DeclarativeElementGeneric['inputsType']>
? never
: DeclarativeElementGeneric['inputsType'],
: AllowObservablePropertySetter<DeclarativeElementGeneric['inputsType']>,
): DirectiveResult;
export function assign<DeclarativeElementGeneric extends ElementDefinitionWithInputsType>(
inputsObject: Record<string, any>,
Expand Down

0 comments on commit 06a4fc0

Please sign in to comment.