@idealyst/mcp-server 1.2.119 → 11.2.120

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  storageGuides,
8
8
  toolDefinitions,
9
9
  translateGuides
10
- } from "./chunk-UD56HXN3.js";
10
+ } from "./chunk-RVMPULO4.js";
11
11
 
12
12
  // src/index.ts
13
13
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
@@ -3128,17 +3128,23 @@ navigator.navigate({ path: '/new-location', replace: true });
3128
3128
 
3129
3129
  ## useParams Hook
3130
3130
 
3131
- Access current route path parameters. Returns \`Record<string, string>\`.
3131
+ Access current route path parameters. Returns \`Record<string, string | undefined>\`.
3132
3132
 
3133
3133
  > **WARNING:** \`useParams()\` does NOT accept generic type arguments. Do NOT write \`useParams<{ id: string }>()\` \u2014 this causes TS2558. Access params by key from the returned record instead.
3134
3134
 
3135
+ > **IMPORTANT:** Param values are \`string | undefined\`, NOT \`string\`. When passing a param to a function that expects \`string\`, you MUST handle the undefined case \u2014 either with a fallback (\`params.id ?? ''\`), a guard (\`if (!params.id) return null\`), or a non-null assertion (\`params.id!\`) if you are certain it exists. Without this, TypeScript will report TS2345.
3136
+
3135
3137
  \`\`\`tsx
3136
3138
  import { useParams } from '@idealyst/navigation';
3137
3139
 
3138
3140
  function UserScreen() {
3139
3141
  // CORRECT \u2014 no type argument
3140
3142
  const params = useParams();
3141
- const userId = params.id; // Path param from /user/:id
3143
+ const userId = params.id; // string | undefined from /user/:id
3144
+
3145
+ // Handle undefined before using in typed contexts:
3146
+ if (!userId) return <Text>User not found</Text>;
3147
+ // Now userId is narrowed to string
3142
3148
 
3143
3149
  // WRONG \u2014 useParams does NOT accept generics
3144
3150
  // const params = useParams<{ id: string }>(); // TS2558 error!
@@ -3149,26 +3155,37 @@ function UserScreen() {
3149
3155
 
3150
3156
  ## useNavigationState Hook
3151
3157
 
3152
- Access navigation state passed via the \`state\` property:
3158
+ Access navigation state passed via the \`state\` property.
3159
+
3160
+ > **IMPORTANT \u2014 Type constraints:**
3161
+ > - \`navigate({ state: {...} })\` requires all values to be \`string | number | boolean\` \u2014 NO \`undefined\` or \`null\`. Do NOT spread objects that may contain undefined values.
3162
+ > - \`useNavigationState<T>()\` requires \`T extends Record<string, unknown>\`. Use \`Record<string, string | number | boolean>\` for the type parameter, or a specific interface with NON-optional fields.
3163
+ > - **Do NOT use optional fields (\`?\`) in the type parameter** \u2014 values passed via state are always present (they were explicitly set by navigate()). Use required fields instead.
3153
3164
 
3154
3165
  \`\`\`tsx
3155
3166
  import { useNavigationState } from '@idealyst/navigation';
3156
3167
 
3157
- // When navigating:
3168
+ // When navigating \u2014 all values must be string | number | boolean:
3158
3169
  navigator.navigate({
3159
3170
  path: '/recording',
3160
3171
  state: { autostart: true, source: 'home' }
3161
3172
  });
3162
3173
 
3163
- // In destination screen:
3174
+ // In destination screen \u2014 use REQUIRED fields (not optional):
3164
3175
  function RecordingScreen() {
3165
- const { autostart, source } = useNavigationState<{
3166
- autostart?: boolean;
3167
- source?: string;
3176
+ const state = useNavigationState<{
3177
+ autostart: boolean;
3178
+ source: string;
3168
3179
  }>();
3169
3180
 
3170
- // autostart = true, source = 'home'
3181
+ // state.autostart = true, state.source = 'home'
3171
3182
  }
3183
+
3184
+ // For multi-step wizards, pass ALL accumulated data as required fields:
3185
+ navigator.navigate({
3186
+ path: '/step3',
3187
+ state: { firstName: name, lastName: last, theme: selectedTheme }
3188
+ });
3172
3189
  \`\`\`
3173
3190
 
3174
3191
  ### Consuming State (Web)