Closed HenryWu01 closed 2 months ago
I encountered the same error when trying to use the webpack plugin
Thank you guys for reporting this I got this error when we upgraded typescript 5.5.x. I fixed the implementation here: https://github.com/ryoppippi/unplugin-typia/commit/8049001f4968acf187bb16a65b60a406cc2ef3e4
I thought this should be fixed in the latest version of unplugin-typia
So maybe something failed to parse options correctly. I would like you to fix it!
PRs are welcome
I tested this repository (https://github.com/ryoppippi/bun-typia-template) using your provided tsconfig settings, and it worked fine.
I need a reproduction repository
@risen228 @HenryWu01
Hi, thank you for the response. It's strange, it is still reproducible even with the given repository.
I am using macOS Sonoma 14.5
on Mac Mini M2
with Bun v1.1.18
henry@Henrys-Mac-mini bun-typia-template % bun run index.ts
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ [unplugin-typia] Cache enabled โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
123992 | const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions;
123993 | let { oldProgram } = createProgramOptions;
123994 | for (const option of commandLineOptionOfCustomType) {
123995 | if (hasProperty(options, option.name)) {
123996 | if (typeof options[option.name] === "string") {
123997 | throw new Error(`${option.name} is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram`);
^
error: target is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram
at createProgram (/Users/henry/.bun/install/cache/typescript@5.5.3@@@1/lib/typescript.js:123997:15)
at /Users/henry/.bun/install/cache/@ryoppippi/unplugin-typia@0.3.8@@@1/src/core/typia.ts:124:21
at getProgramAndSource (/Users/henry/.bun/install/cache/@ryoppippi/unplugin-typia@0.3.8@@@1/src/core/typia.ts:88:2)
at /Users/henry/.bun/install/cache/@ryoppippi/unplugin-typia@0.3.8@@@1/src/core/typia.ts:43:38
Bun v1.1.18 (macOS arm64)
To be more specific, using the repository's tsconfig or my tsconfig does not affect this error.
Unfortunately, I canโt give an example of reproduction now, maybe Iโll do it later.
But I can say that I use macos sonoma 14.1 (Macbook M3 Max), Node.js platform (so I don't think it's something Bun-specific)
To be more precise, this happened in one of the applications in a monorepo based on Nx, and tsconfig was inherited from the root tsconfig via extends
Hi, thank you for the response. It's strange, it is still reproducible even with the given repository.
I am using
macOS Sonoma 14.5
onMac Mini M2
withBun v1.1.18
henry@Henrys-Mac-mini bun-typia-template % bun run index.ts โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ โ โ [unplugin-typia] Cache enabled โ โ โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ 123992 | const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions; 123993 | let { oldProgram } = createProgramOptions; 123994 | for (const option of commandLineOptionOfCustomType) { 123995 | if (hasProperty(options, option.name)) { 123996 | if (typeof options[option.name] === "string") { 123997 | throw new Error(`${option.name} is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram`); ^ error: target is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram at createProgram (/Users/henry/.bun/install/cache/typescript@5.5.3@@@1/lib/typescript.js:123997:15) at /Users/henry/.bun/install/cache/@ryoppippi/unplugin-typia@0.3.8@@@1/src/core/typia.ts:124:21 at getProgramAndSource (/Users/henry/.bun/install/cache/@ryoppippi/unplugin-typia@0.3.8@@@1/src/core/typia.ts:88:2) at /Users/henry/.bun/install/cache/@ryoppippi/unplugin-typia@0.3.8@@@1/src/core/typia.ts:43:38 Bun v1.1.18 (macOS arm64)
To be more specific, using the repository's tsconfig or my tsconfig does not affect this error.
I found the issue, my bun is sticking with version 0.3.8
for some unknown reason, running bunx jsr add @ryoppippi/unplugin-typia
again fixes this issue with the given repository.
henry@Henrys-Mac-mini bun-typia-template % bunx jsr add @ryoppippi/unplugin-typia
Installing @ryoppippi/unplugin-typia...
$ bun add @ryoppippi/unplugin-typia@npm:@jsr/ryoppippi__unplugin-typia
bun add v1.1.18 (5a0b9352)
$ ts-patch install && typia patch
[+] ts-patch installed!
----------------------------------------
Typia Setup Wizard
----------------------------------------
Since TypeScript v5.3 update, "tsc" no more parses JSDoc comments.
Therefore, "typia" revives the JSDoc parsing feature by patching "tsc".
This is a temporary feature of "typia", and it would be removed when "ts-patch" being updated.
+ @types/bun@1.1.6
+ ts-patch@3.2.1
+ typescript@5.5.3
+ typia@6.4.3
installed @ryoppippi/unplugin-typia@0.5.4
126 packages installed [4.65s]
Completed in 4s
henry@Henrys-Mac-mini bun-typia-template % bun run index.ts
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ [unplugin-typia] Cache enabled โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
{
member: {
email: "example@example.com",
age: 25,
},
is: true,
}
{
random: {
email: "fokssgbfhg@fndrzrzgba.rky",
age: 89.63818943976189,
},
}
Hi, thank you for the response. It's strange, it is still reproducible even with the given repository. I am using
macOS Sonoma 14.5
onMac Mini M2
withBun v1.1.18
henry@Henrys-Mac-mini bun-typia-template % bun run index.ts โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ โ โ [unplugin-typia] Cache enabled โ โ โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ 123992 | const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions; 123993 | let { oldProgram } = createProgramOptions; 123994 | for (const option of commandLineOptionOfCustomType) { 123995 | if (hasProperty(options, option.name)) { 123996 | if (typeof options[option.name] === "string") { 123997 | throw new Error(`${option.name} is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram`); ^ error: target is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram at createProgram (/Users/henry/.bun/install/cache/typescript@5.5.3@@@1/lib/typescript.js:123997:15) at /Users/henry/.bun/install/cache/@ryoppippi/unplugin-typia@0.3.8@@@1/src/core/typia.ts:124:21 at getProgramAndSource (/Users/henry/.bun/install/cache/@ryoppippi/unplugin-typia@0.3.8@@@1/src/core/typia.ts:88:2) at /Users/henry/.bun/install/cache/@ryoppippi/unplugin-typia@0.3.8@@@1/src/core/typia.ts:43:38 Bun v1.1.18 (macOS arm64)
To be more specific, using the repository's tsconfig or my tsconfig does not affect this error.
I found the issue, my bun is sticking with version
0.3.8
for some unknown reason, runningbunx jsr add @ryoppippi/unplugin-typia
again fixes this issue with the given repository.henry@Henrys-Mac-mini bun-typia-template % bunx jsr add @ryoppippi/unplugin-typia Installing @ryoppippi/unplugin-typia... $ bun add @ryoppippi/unplugin-typia@npm:@jsr/ryoppippi__unplugin-typia bun add v1.1.18 (5a0b9352) $ ts-patch install && typia patch [+] ts-patch installed! ---------------------------------------- Typia Setup Wizard ---------------------------------------- Since TypeScript v5.3 update, "tsc" no more parses JSDoc comments. Therefore, "typia" revives the JSDoc parsing feature by patching "tsc". This is a temporary feature of "typia", and it would be removed when "ts-patch" being updated. + @types/bun@1.1.6 + ts-patch@3.2.1 + typescript@5.5.3 + typia@6.4.3 installed @ryoppippi/unplugin-typia@0.5.4 126 packages installed [4.65s] Completed in 4s henry@Henrys-Mac-mini bun-typia-template % bun run index.ts โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ โ โ [unplugin-typia] Cache enabled โ โ โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ { member: { email: "example@example.com", age: 25, }, is: true, } { random: { email: "fokssgbfhg@fndrzrzgba.rky", age: 89.63818943976189, }, }
Can you confirm running bunx jsr add @ryoppippi/unplugin-typia
fixes this issue @risen228?
I think I have figured out what's happening @ryoppippi @risen228.
Let me explain it.
The main problem was the typia documentation. It is OUTDATED.
On typia
documentation, it says:
bun add @ryoppippi/unplugin-typia
bun add typia
bun typia setup
This bun add
command does not contain jsr
which means bun
will search the package on npmjs instead of jsr.
You can see exactly the version of @ryoppippi/unplugin-typia
on npmjs
is 0.3.8
, not 0.5.4
which contains the bug fixes.
Ohhhhh, OKay.
Actually, I wrote this doc.
So could you create a PR to typia
?
Ohhhhh, OKay. Actually, I wrote this doc. So could you create a PR to
typia
?
Sure, I will create it now.
@HenryWu01 @risen228 Sorry guys, I forgot that I uploaded it to npm!!
I'll deprecate it.
Okay, I deleted the package on npm rn
I have created a pull request, waiting for typia
to merge. Thank you so much for investigating @ryoppippi!
Thank you for sorting out the situation so quickly =)
You're welcome. We can close this issue after typia
have merge the pull request. :D
Thanks @ryoppippi for developing this awesome plugin!
@HenryWu01 @risen228 Thank you so much and sorry for made you confused!
Cheers!!
@HenryWu01 Ok, after merged https://github.com/samchon/typia/pull/1154 , please close this issue!
@HenryWu01 @risen228 Thank you so much and sorry for made you confused!
Cheers!!
@HenryWu01 Ok, after merged samchon/typia#1154 , please close this issue!
Not problem at all. Thank you so much for your effort not only on debugging this issue but also developing the awesome plugin.
Close this issue since correction has been merged into typia
documentation.
I have first configured
type
following the instructions on documentation, and then installedunplugin-typia
. My config are listed below:preload.ts
bunfig.toml
tsconfig.json
When I use the command
bun run src\index.ts
, this error appears: