diff --git a/.changeset/blue-pugs-peel.md b/.changeset/blue-pugs-peel.md
new file mode 100644
index 0000000000000000000000000000000000000000..ec492233838dc022793524c797992f0e69c4b877
--- /dev/null
+++ b/.changeset/blue-pugs-peel.md
@@ -0,0 +1,5 @@
+---
+"create-llama": patch
+---
+
+Fix NextJS for TS 5.2
diff --git a/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx b/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx
index 21ab81dd7cd270261849500488bcbb47de5d082a..54a173892819e757e48503ca3ec9aedc389b824c 100644
--- a/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx
+++ b/templates/types/streaming/nextjs/app/components/ui/chat/chat-message/markdown.tsx
@@ -17,12 +17,12 @@ const MemoizedReactMarkdown: FC<Options> = memo(
 const preprocessLaTeX = (content: string) => {
   // Replace block-level LaTeX delimiters \[ \] with $$ $$
   const blockProcessedContent = content.replace(
-    /\\\[(.*?)\\\]/gs,
+    /\\\[([\s\S]*?)\\\]/g,
     (_, equation) => `$$${equation}$$`,
   );
   // Replace inline LaTeX delimiters \( \) with $ $
   const inlineProcessedContent = blockProcessedContent.replace(
-    /\\\((.*?)\\\)/gs,
+    /\\\[([\s\S]*?)\\\]/g,
     (_, equation) => `$${equation}$`,
   );
   return inlineProcessedContent;