Giter Site home page Giter Site logo

Comments (3)

mvanbutselaar avatar mvanbutselaar commented on August 17, 2024 2

Been getting this Error: Failed to add @ts-expect-error within template expression. as well. In my case this only happens when having the addConversionsPlugin enabled, but it might happen due to other text/line/formatting changes as well. In my case it actually tries to add a @ts-expect-error about setTimeout not being defined (had the the DOM lib disabled), but the offending line did nothing with setTimeout. As if the diagnostic was not referring to the correct position. Which is possible, as some empty lines are stripped and some formatting changed occur due to the transformations done by addConversionsPlugin.

I am not using the ts-migrate command directly (or ts-migrate-server for that matter), but my code is heavily based on that code, I found that in this ts-migrate-server/src/migrate/index.ts#L85 there was an issue. The sourceFile changes, and the current sourceFile and diagnostics might be incorrect. Fixed this by updating the sourceFile const in the plugins/sourceFiles loops to update with the return value from project.updateSourceFile. This might have already been an issue before, but this commit of ts-migrate has only made it worse.

Hope this helps you, or helps in creating a fix.

from ts-migrate.

Rudeg avatar Rudeg commented on August 17, 2024

haven't seen this before. Could you please share source code or an example, where it failed?

from ts-migrate.

jamestowers avatar jamestowers commented on August 17, 2024

I get this when converting styled components:

export const ButtonStyled = styled.button `
  // It tries to add @ts-expect-error here
  ${props => props.isSmall &&
    css `
      ${SmallButtonStyles}
    `}
`;

from ts-migrate.

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.