Repository navigation
@link JSDoc annotation cause to fatal error #1058
Description
Activity
- changed the title
[-][Bug] @link annotation cause to fatal error[/-][+][Bug] @link JSDoc annotaion cause to fatal error[/+]on Aug 1, 2021 - changed the title
[-][Bug] @link JSDoc annotaion cause to fatal error[/-][+][Bug] @link JSDoc annotation cause to fatal error[/+]on Aug 1, 2021 I am debugging the compiling process and here I will put interesting things, that can help
Stacktrace from point, where diagnostic error is being added
Stacktrace
add(), typescript.js:17233 error(), typescript.js:45782 resolveNameHelper(), typescript.js:46734 resolveName(), typescript.js:46386 resolveEntityName(), typescript.js:47678 getSymbolOfNameOrPropertyAccessExpression(), typescript.js:80766 getSymbolAtLocation(), typescript.js:80832 getSymbolAtLocation(), typescript.js:45218 buildLinkParts(), typescript.js:120702 anonymous(), typescript.js:130706 flatMap(), typescript.js:709 getDisplayPartsFromComment(), typescript.js:130706 getCommentDisplayParts(), typescript.js:130730 anonymous(), typescript.js:130696 forEachUnique(), typescript.js:120461 getJsDocTagsFromDeclarations(), typescript.js:130693 getJsDocTagsOfSignature(), typescript.js:153090 SignatureObject.getJsDocTags(), typescript.js:153075 collectAnnotations(), annotations.js:31 getSignatureAnnotations(), annotations.js:85 anonymous(), annotations.js:141 isInTupleReturnFunction(), annotations.js:141 transformExpressionsInReturn(), return.js:39 transformReturnStatement(), return.js:83 transformNode(), context.js:44 anonymous(), context.js:70 transformStatements(), context.js:70 transformFunctionBodyContent(), function.js:37 transformFunctionBody(), function.js:74 transformFunctionToExpression(), function.js:135 transformFunctionDeclaration(), function.js:180 transformNode(), context.js:44 anonymous(), context.js:70 transformStatements(), context.js:70 transformSourceFileNode(), sourceFile.js:29 transformNode(), context.js:44 transformSourceFile(), index.js:28 processSourceFile(), transpile.js:52 anonymous(), transformers.js:12 transformSourceFileOrBundle(), typescript.js:84905 transformation(), typescript.js:102910 transformRoot(), typescript.js:102937 transformNodes(), typescript.js:102921 emitJsFileOrBundle(), typescript.js:103606 emitSourceFileOrBundle(), typescript.js:103553 forEachEmittedFile(), typescript.js:103274 emitFiles(), typescript.js:103533 emitWorker(), typescript.js:110329 anonymous(), typescript.js:110306 runWithCancellationToken(), typescript.js:110401 emit(), typescript.js:110306 getProgramTranspileResult(), transpile.js:90 emit(), transpiler.js:20 performCompilation(), tstl.js:84 executeCommandLine(), tstl.js:60 anonymous(), tstl.js:157 Module._compile(), loader.js:1063 Module._extensions..js(), loader.js:1092 Module.load(), loader.js:928 Module._load(), loader.js:769 executeUserEntryPoint(), run_main.js:72 anonymous(), run_main_module.js:17
- changed the title
[-][Bug] @link JSDoc annotation cause to fatal error[/-][+]@link JSDoc annotation cause to fatal error[/+]on Aug 2, 2021 - addedscope: transformationTransformation of TS to LuaTransformation of TS to Lua
on Aug 2, 2021 I have tried debugging this a bit too, your stack trace seems correct. This actually looks more like a bug in TypeScript. As far as I can see the last thing tstl does is to try to call
getJsDocTags()on thehelloWorldfunction (in your example) signature symbol, which then prompts TS to try to resolvehttpsas a variable name for some reason.This seems like it should be easily reproducible with the example code you posted here and a small compiler API program that just calls getJsDocTags() on the function's signature symbol, no extra packages required.
You can open an issue with TypeScript yourself, or if you would like me to do it I can do so somewhere later this week.
- removedscope: transformationTransformation of TS to LuaTransformation of TS to Lua
on Aug 3, 2021 I have tried to reproduce this error with typescript.js, however it works correctly for me
Code I used
const ts = require("typescript"); const rootNames = ["C:/Users/Toliak/WebstormProjects/p_20210801/index.ts"] const options = { target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS } const projectReferences = undefined const configFileParsingDiagnostics = [] const program = ts.createProgram({ rootNames, options, projectReferences, configFileParsingDiagnostics, }); const sources = program.getSourceFiles() const source = sources[5]; // The last const result = program.emit() const statement = source.statements[0] const tags = statement.symbol.getJsDocTags() console.log('tags', tags) const diag = ts.getPreEmitDiagnostics(program) console.log(result) console.log(diag) console.log('ok')
Output:
> node custom-compile.js tags [ { name: 'see', text: [ [Object], [Object], [Object], [Object] ] } ] { emitSkipped: false, diagnostics: [], emittedFiles: undefined, sourceMaps: undefined, exportedModulesFromDeclarationEmit: undefined } [] okAm I doing something wrong while trying to reproduce the error with typescript API calls?
Amazing job, this is exactly what I had in mind. I think you only need a small tweak to match what TSTL does in this case. On closer inspection it seems the symbol part was a mistake on my part, sorry! I double checked below modification next to the TSTL code:
Intead of:
const tags = statement.symbol.getJsDocTags()
I think tstl does this:
const type = program.getTypeChecker().getTypeAtLocation(statement); const signatures = type.getCallSignatures(); for (const signature of signatures) { console.log('tags', signature.getJsDocTags()) }
I have fixed the code snipped, now it looks like:
New code snipped for testing
const ts = require("typescript"); const rootNames = ["C:/Users/Toliak/WebstormProjects/p_20210801/index.ts"] const options = { target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS } const projectReferences = undefined const configFileParsingDiagnostics = [] const program = ts.createProgram({ rootNames, options, projectReferences, configFileParsingDiagnostics, }); const sources = program.getSourceFiles() const source = sources[5]; // The last const result = program.emit() const statement = source.statements[0] // const type = program.getTypeChecker().getTypeAtLocation(statement); const signatures = type.getCallSignatures(); for (const signature of signatures) { console.log('tags', signature.getJsDocTags()) } // const diag = ts.getPreEmitDiagnostics(program) console.log(result) console.log(diag) console.log('ok')
The output now is:
tags [ { name: 'see', text: [ [Object], [Object], [Object], [Object] ] } ] { emitSkipped: false, diagnostics: [], emittedFiles: undefined, sourceMaps: undefined, exportedModulesFromDeclarationEmit: undefined } [] okSo, it is still works correctly for pure TypeScript API
That looks correct and basically how I understand TSTL to work. I will have to debug TSTL some more (I can reproduce this quite easily), maybe some of these variables are not exactly what I expect them to be. I might check in the weekend.
Reacted by ToliakThis will be fixed by #1090 (it deletes the method that is causing the error)
- linked a pull request that will close this issueRemove tupleReturn annotation #1090
on Aug 16, 2021
Description
I have updated TypeScriptToLua from
0.39.3to the latest,0.41.0, and received an error:error TS2304: Cannot find name 'https'However, I use https only in my JSDoc comment.
I have prepared the simple example to reproduce the error.
Code
Also those lines cause to error:
* @see a a a a {@link https://toliak.ru/ SomeWebsite }* @asdadasd {@link https://toliak.ru/ SomeWebsite }* @asdadasd a a a {@link https://toliak.ru/ SomeWebsite }And those lines works fine:
* aboba {@link https://toliak.ru/ SomeWebsite }* {@link https://toliak.ru/ SomeWebsite }I think that is a bug, because I use https in the comment and there is no rules, that prohibit me from using link here.
My environment version info:
NPM version
NPM Packages
What about
tscIt works correctly