Skip to content

Object literal may only specify known properties, and 'property' does not exist in type SomeType #1761

@7nik

Description

@7nik

Steps to reproduce

function normalise_trace_logs([log]: any[]) {
	let normalised = [];

    if (typeof log === "string" && log.includes("%c")) {
        normalised.push({ log, highlighted: log.includes("foo") });
    } else {
        normalised.push({ log });
    }

	return normalised;
}

function equal<T>(_actual: T, _expected: T): void {}

equal(normalise_trace_logs([]), [
    { log: 'effect' },
    { log: '$derived', highlighted: true },
    { log: 'double', highlighted: false },
    { log: 4 },
]);

Behavior with typescript@5.8

No errors

Behavior with tsgo

src/main.ts:17:24 - error TS2353: Object literal may only specify known properties, and 'highlighted' does not exist in type '{ log: any; }'.

17     { log: '$derived', highlighted: true },
                          ~~~~~~~~~~~

src/main.ts:18:22 - error TS2353: Object literal may only specify known properties, and 'highlighted' does not exist in type '{ log: any; }'.

18     { log: 'double', highlighted: false },
                        ~~~~~~~~~~~


Found 2 errors in the same file, starting at: src/main.ts:17

Context: another error that appeared in the TSGo CI check on the Svelte repo.
Seems to be caused by #1759

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions