Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
7ff78d1b
Unverified
Commit
7ff78d1b
authored
Apr 25, 2025
by
Jiwon Choi
Committed by
GitHub
Apr 25, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ts-next-plugin] update log for utils (#78538)
Improve the log for debugging when getting possibly undefined values.
parent
68c3e13a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
utils.ts
packages/next/src/server/typescript/utils.ts
+24
-2
No files found.
packages/next/src/server/typescript/utils.ts
View file @
7ff78d1b
...
@@ -35,11 +35,33 @@ export function getInfo() {
...
@@ -35,11 +35,33 @@ export function getInfo() {
}
}
export
function
getTypeChecker
()
{
export
function
getTypeChecker
()
{
return
info
.
languageService
.
getProgram
()?.
getTypeChecker
()
const
program
=
info
.
languageService
.
getProgram
()
if
(
!
program
)
{
log
(
'Failed to get program while while running getTypeChecker.'
)
return
}
const
typeChecker
=
program
.
getTypeChecker
()
if
(
!
typeChecker
)
{
log
(
'Failed to get type checker while running getTypeChecker.'
)
return
}
return
typeChecker
}
}
export
function
getSource
(
fileName
:
string
)
{
export
function
getSource
(
fileName
:
string
)
{
return
info
.
languageService
.
getProgram
()?.
getSourceFile
(
fileName
)
const
program
=
info
.
languageService
.
getProgram
()
if
(
!
program
)
{
log
(
'Failed to get program while running getSource for: '
+
fileName
)
return
}
const
sourceFile
=
program
.
getSourceFile
(
fileName
)
if
(
!
sourceFile
)
{
log
(
'Failed to get source file while running getSource for: '
+
fileName
)
return
}
return
sourceFile
}
}
export
function
removeStringQuotes
(
str
:
string
):
string
{
export
function
removeStringQuotes
(
str
:
string
):
string
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment