-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[types] Expand should ignore builtins (#654)
- Loading branch information
Showing
2 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
client/sandbox/strong-init-vite/src/typescript_tests_backwards_compat_date.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { init, BackwardsCompatibleSchema } from "@instantdb/react"; | ||
|
||
type Message = { | ||
content: string; | ||
createdAt: Date; | ||
}; | ||
|
||
type User = { | ||
email: string; | ||
}; | ||
|
||
type Schema = { | ||
messages: Message; | ||
creator: User; | ||
}; | ||
|
||
type EmojiName = "fire" | "wave" | "confetti" | "heart"; | ||
|
||
type Rooms = { | ||
chat: { | ||
presence: { | ||
name: string; | ||
avatarURI: string; | ||
}; | ||
topics: { | ||
emoji: { | ||
name: EmojiName; | ||
rotationAngle: number; | ||
directionAngle: number; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
// ---- | ||
// Core | ||
|
||
const db = init<BackwardsCompatibleSchema<Schema, Rooms>>({ | ||
appId: import.meta.env.VITE_INSTANT_APP_ID, | ||
}); | ||
|
||
const res = db.useQuery({ messages: { creator: {} }}) | ||
const m = res.data?.messages[0]; | ||
// Hover over `m` to see that `m?.createdAt` and see that it says `Date`; | ||
m?.createdAt; | ||
|
||
|
||
|