Skip to content

Commit

Permalink
Fix type tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Sep 27, 2023
1 parent be570b3 commit 93f8bcd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
13 changes: 7 additions & 6 deletions preact/errors.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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) {
Expand Down
13 changes: 7 additions & 6 deletions react/errors.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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) {
Expand Down
19 changes: 10 additions & 9 deletions vue/errors.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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) {
Expand Down

0 comments on commit 93f8bcd

Please sign in to comment.