Skip to content

Casting tricks don't work #18

Closed
Closed

Description

@jrieken

This is an example (there are a few more) where tsec complaints although it shouldn't

https://github.com/microsoft/vscode/blob/5f569de4cd54e43d0239e339b5f4e60f367cf75f/src%2Fvs%2Fworkbench%2Fcontrib%2Fnotebook%2Fbrowser%2Fview%2Frenderers%2FcellRenderer.ts#L595

Activity

  1. Siegrift commented on Nov 30, 2020

    @Siegrift
    Contributor

    This is intended.

    Variable linesHtml has type string | TrustedHTML so you only need casting to string.
    Assignment element.innerHTML = linesHtml as string; works properly.

    The reason for this is, that the casting trick through unknown requires the variable type to be exactly TrustedHTML (and it's an union in your case).

  2. jrieken commented on Nov 30, 2020

    @jrieken
    Author

    Assignment element.innerHTML = linesHtml as string; works properly.

    Pretty sure that I have tried this but without success. Tho, I might have been on a wrong version of tsec - the yarn upgrade trick seems to be buggy and we are kinda desperate for #17. Folks keep getting a wrong version of tsec and aren't happy with tsec at all

  3. engelsdamien commented on Dec 7, 2020

    @engelsdamien

    I think I figured it out. The latest version of tsec seems to have lost the postinstall script that allows it to build, so even with the upgrade, it is still running old code. I've raised the issue internally and we'll work on a fix.

  4. jrieken commented on Dec 9, 2020

    @jrieken
    Author

    Oh, that explains a lot

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions