Skip to content

Unable to parse file: 'Unexpected token ...' #34

Description

@ndr47

I am getting the following error:

Unable to parse file: /path/to/file 
Error: Error: Line XX: Unexpected token ...
...
description: 'Unexpected token ...'

My tsconfig.json:

{
	"compilerOptions": {
		"alwaysStrict": true,
		"allowJs": true,
		"baseUrl": ".",
		"declaration": true,
		"esModuleInterop": true,
		"experimentalDecorators": true,
		"lib": [
			"ESNext",
			"ESNext.AsyncIterable",
			"DOM"
		],
		"module": "commonjs",
		"moduleResolution": "node",
		"noFallthroughCasesInSwitch": true,
		"noImplicitThis": true,
		"noImplicitAny": true,
		"noUnusedLocals": true,
		"noUnusedParameters": true,
		"outDir": "./dist",
		"rootDir": "./",
		"paths": {
			"~/*": [
				"./*"
			],
			"@/*": [
				"./*"
			]
		},
		"sourceMap": true,
		"strict": true,
		"strictNullChecks": true,
		"strictFunctionTypes": true,
		"strictPropertyInitialization": true,
		"target": "ES2018",
	},
	"include": [
		"src/**/*"
	],
	"exclude": [
		"node_modules"
	]
}

My only .ts file in /src

// /src/index.ts
const myarr:string[] = [];

const a = {
	...myarr
}

Step to reproduce:

tsc -b
npx tspath -f
// Typescript version
Version 4.3.2

Why the pareser is not understanfing the syntax "..."? Is there any configuration I am missing?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions