Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Targets returning void fail to type check #321

Open
deciduously opened this issue Nov 11, 2024 · 1 comment
Open

Targets returning void fail to type check #321

deciduously opened this issue Nov 11, 2024 · 1 comment

Comments

@deciduously
Copy link
Member

deciduously commented Nov 11, 2024

Given the following tangram definition:

export default tg.target(() => {});

I can build it:

$ cargo run -- build ./a
info target tgt_01a1ak4y5p6gern0qk513etycjxh6xvv577tv25j0wbnbbmja9pmrg
info build bld_00069htxn5fsx335frdar0bd8xg0
⟳ <unknown>
✓ #default
null

But it fails to typecheck:

$ cargo run -- check ./a
    Blocking waiting for file lock on build directory
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 6.41s
     Running `target/debug/tangram check ./a`
error: No overload matches this call.
  Overload 1 of 2, '(function_: () => Unresolved<Value>): Target<[], Value>', gave the following error.
    Argument of type '() => void' is not assignable to parameter of type '() => Unresolved<Value>'.
      Type 'void' is not assignable to type 'Unresolved<Value>'.
  Overload 2 of 2, '(...args: Args<Arg>): Promise<Target<Value[], Value>>', gave the following error.
    Argument of type '() => void' is not assignable to parameter of type 'Unresolved<MaybeNestedArray<string | Template | Artifact | Target<Value[], Value> | MaybeMutationMap<ArgObject> | undefined>>'.
      Type '() => void' is missing the following properties from type 'Target<Value[], Value>': id, args, checksum, env, and 3 more.
   dir_013pt0njk9mtxqs0q8wwfwhcjd1kkzrzx5me3c6tj82ktdcntc21tg:tangram.ts:1:26
error failed to run the command
-> type checking failed
@deciduously
Copy link
Member Author

Added a failing test in #336.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant