GithubHelp home page GithubHelp logo

Comments (7)

NetanelBasal avatar NetanelBasal commented on August 28, 2024 1

I trust you to reach a solution and open a PR

from spectator.

profanis avatar profanis commented on August 28, 2024 1

Sorry for the delay.
This is the relevant PR #652

from spectator.

stackblitz avatar stackblitz commented on August 28, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

from spectator.

profanis avatar profanis commented on August 28, 2024

How about if we provide a more loose function overload?

https://github.com/ngneat/spectator/blob/master/projects/spectator/src/lib/spectator/spectator.ts#L44

  public setInput(input: string, inputValue: unknown): void;

I think something similar exists also in Angular repo
https://github.com/angular/angular/blob/da906fdafcbb302fa280a162d1c1f04369be2efa/packages/core/src/linker/component_factory.ts#L34

from spectator.

profanis avatar profanis commented on August 28, 2024

How about if we provide a more loose function overload?

https://github.com/ngneat/spectator/blob/master/projects/spectator/src/lib/spectator/spectator.ts#L44

  public setInput(input: string, inputValue: unknown): void;

I think something similar exists also in Angular repo https://github.com/angular/angular/blob/da906fdafcbb302fa280a162d1c1f04369be2efa/packages/core/src/linker/component_factory.ts#L34

@kfrancois @NetanelBasal what do you think?

from spectator.

kfrancois avatar kfrancois commented on August 28, 2024

Hi @profanis! Thank you for logging this issue.

I think what you propose is the best possible option at the moment. Unfortunately, input aliases are defined as string inside the Angular repo:

interface InputOptions<ReadT, WriteT> {
    alias?: string;
    transform?: (v: WriteT) => ReadT;

If this were a generic type (or rather, if alias was generic instead of string), we would at least be able to infer the correct field name and use it for setInput (at least for signal inputs, traditional inputs we wouldn't be able to do anything), but for now it feels safer to lose type info here and go with input: string, inputValue: unknown.

from spectator.

NetanelBasal avatar NetanelBasal commented on August 28, 2024

Can we close it?

from spectator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.