From 93f8bcd01ea92c8db2fd939c0e4292715bfac40f Mon Sep 17 00:00:00 2001 From: Andrey Sitnik Date: Wed, 27 Sep 2023 22:56:28 +0200 Subject: [PATCH] Fix type tests --- preact/errors.ts | 13 +++++++------ react/errors.ts | 13 +++++++------ vue/errors.ts | 19 ++++++++++--------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/preact/errors.ts b/preact/errors.ts index 94d592a..ae74637 100644 --- a/preact/errors.ts +++ b/preact/errors.ts @@ -1,5 +1,4 @@ -import type { MapStore} from 'nanostores' -import { map } from 'nanostores' +import { map, type MapStore } from 'nanostores' import { syncMapTemplate } from '../sync-map-template/index.js' import { useFilter, useSync } from './index.js' @@ -22,10 +21,12 @@ if (post.isLoading) { post.title = 'New title' } -let postListItem = postList.stores.get('10')!.value! -if (postListItem.isLoading) { - // THROWS Property 'title' does not exist - postListItem.title = 'New title' +if (!postList.isLoading) { + let postListItem = postList.stores.get('10')!.value! + if (postListItem.isLoading) { + // THROWS Property 'title' does not exist + postListItem.title = 'New title' + } } if (custom.isLoading) { diff --git a/react/errors.ts b/react/errors.ts index 94d592a..ae74637 100644 --- a/react/errors.ts +++ b/react/errors.ts @@ -1,5 +1,4 @@ -import type { MapStore} from 'nanostores' -import { map } from 'nanostores' +import { map, type MapStore } from 'nanostores' import { syncMapTemplate } from '../sync-map-template/index.js' import { useFilter, useSync } from './index.js' @@ -22,10 +21,12 @@ if (post.isLoading) { post.title = 'New title' } -let postListItem = postList.stores.get('10')!.value! -if (postListItem.isLoading) { - // THROWS Property 'title' does not exist - postListItem.title = 'New title' +if (!postList.isLoading) { + let postListItem = postList.stores.get('10')!.value! + if (postListItem.isLoading) { + // THROWS Property 'title' does not exist + postListItem.title = 'New title' + } } if (custom.isLoading) { diff --git a/vue/errors.ts b/vue/errors.ts index 2c4395a..74271fa 100644 --- a/vue/errors.ts +++ b/vue/errors.ts @@ -1,5 +1,4 @@ -import type { MapStore} from 'nanostores' -import { map } from 'nanostores' +import { map, type MapStore } from 'nanostores' import { syncMapTemplate } from '../sync-map-template/index.js' import { useFilter, useSync } from './index.js' @@ -25,13 +24,15 @@ if (post.value.isLoading) { post.value.title = 'New title' } -let postListItem = postList.value.stores.get('10')!.value! -if (postListItem.isLoading) { - // THROWS Property 'title' does not exist - postListItem.title = 'New title' -} else { - // THROWS Cannot assign to 'title' because it is a read-only - postListItem.title = 'New title' +if (!postList.value.isLoading) { + let postListItem = postList.value.stores.get('10')!.value! + if (postListItem.isLoading) { + // THROWS Property 'title' does not exist + postListItem.title = 'New title' + } else { + // THROWS Cannot assign to 'title' because it is a read-only + postListItem.title = 'New title' + } } if (custom.value.isLoading) {