#Cannot destructure property 'pos' of 'file.referencedFiles[index]' as it is undefined.

6 messages · Page 1 of 1 (latest)

kindred stream
#

Hi All,

I have an Nx project and I keep getting the titular error reoccurring when I run a build on a library. When it happens I've been deleting the lib and then recreating it from scratch, copying every file across manually but that's getting tedious.

I'd like to understand exactly what this error means in the context of the TypeScript transpiler and what's happening under the hood, so I can effectively debug in the future and isolate the cause (as well as just better understand the inner workings of TypeScript in general).

From the stack trace I can see that the error is occurring in a function with the signature: 'getReferencedFileLocation(program, ref)' in typescript.js and further investigation shows that the referenced files array on the files object is empty when dereference occurs, which is causing the error.

lapis ether
#

so this error is coming from tsc?

#

it shouldn't be throwing, so if that's the case, that may be a bug. try asking in #compiler-internals-and-api and check the issues

kindred stream
#

esbuild I believe (not sure if it would have done the same if it was tsc), but thanks, I'll ask there

lapis ether
#

i don't think esbuild is built on tsc, so you may have to ask in their support channels

kindred stream
#

👍