Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[labs/task] render does not return a useful type #2301

@mohe2015

Description

@mohe2015

Description

When using render of a @lit-labs/task Task the method is typed as having a return type of unknown.

Steps to Reproduce

  1. Write this code
import type { Task } from "@lit-labs/task/task.js";

const task: Task = undefined!;

// Type 'unknown' is not assignable to type 'number'.ts(2322)
const test: number = task.render({
  complete: () => 1
})
  1. The code does not typecheck because it tries to assign type unknown to number. (Adding the three other handlers does not help as you can see in how the source code is typed)

Metadata

Metadata

Assignees

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions