Skip to content

Commit 869acc2

Browse files
authored
fix(realtime): Fix type errors in realtime templates (#482)
1 parent d1c48c2 commit 869acc2

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

docs/docs/realtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ type Subscription {
247247
248248
### Countdown Timer Example
249249
250-
Counts down from a starting values by an interval.
250+
Counts down from a starting value by an interval.
251251
252252
```graphql
253253
subscription CountdownFromInterval {

packages/cli/src/commands/setup/realtime/templates/subscriptions/countdown/countdown.ts.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const schema = gql`
2020
const countdown = {
2121
countdown: {
2222
subscribe: (
23-
_,
23+
_: unknown,
2424
{
2525
from = 100,
2626
interval = 10,

packages/cli/src/commands/setup/realtime/templates/subscriptions/newMessage/newMessage.ts.template

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,32 @@ export type NewMessageChannel = {
1616
export type NewMessageChannelType = PubSub<NewMessageChannel>
1717

1818
/**
19-
* To test this NewMessage subscription, run the following in one GraphQL Playground to subscribe:
19+
* To test this NewMessage subscription, run the following in one GraphQL
20+
* Playground to subscribe:
2021
*
2122
* subscription ListenForNewMessagesInRoom {
2223
* newMessage(roomId: "1") {
23-
* body
2424
* from
25+
* body
2526
* }
2627
* }
2728
*
2829
*
29-
* And run the following in another GraphQL Playground to publish and send a message to the room:
30+
* And run the following in another GraphQL Playground to publish and send a
31+
* message to the room:
3032
*
3133
* mutation SendMessageToRoom {
3234
* sendMessage(input: {roomId: "1", from: "hello", body: "bob"}) {
33-
* body
3435
* from
36+
* body
3537
* }
3638
* }
3739
*/
3840
const newMessage = {
3941
newMessage: {
4042
subscribe: (
41-
_,
42-
{ roomId },
43+
_: unknown,
44+
{ roomId }: { roomId: string },
4345
{ pubSub }: { pubSub: NewMessageChannelType }
4446
) => {
4547
logger.debug({ roomId }, 'newMessage subscription')

packages/cli/src/commands/setup/realtime/templates/subscriptions/newMessage/rooms.ts.template

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import type { SendMessageInput } from 'types/graphql'
2-
import type { NewMessageChannelType } from 'src/subscriptions/newMessage/newMessage.js'
2+
33
import { logger } from 'src/lib/logger'
4+
import type { NewMessageChannelType } from 'src/subscriptions/newMessage/newMessage.js'
45

5-
export const room = ({ id }) => [id]
6+
export const room = ({ id }: { id: string }) => [id]
67

78
export const sendMessage = async (
89
{ input }: { input: SendMessageInput },

0 commit comments

Comments
 (0)