Git Product home page Git Product logo

Comments (9)

runspired avatar runspired commented on September 27, 2024 1

ok I pulled this down and confirmed a suspicion: the problem here is that neither the project's tsconfig nor the @tsconfig/ember base specifies skipLibCheck: true, which it ought to.

There's no way for libraries to avoid shipping errors in types to consumers (literally), so skipLibCheck should always be used.

cc @NullVoxPopuli / @wagenet / @gitKrystan

from data.

runspired avatar runspired commented on September 27, 2024

haven't had time to poke through the project you posted; however, this seems almost certainly to be a config issue. We use glint within EmberData itself already, and use it at work with EmberData's native types.

from data.

NullVoxPopuli avatar NullVoxPopuli commented on September 27, 2024

skipLibCheck: true, which it ought to.

idk, it falls back to any when library code goes wrong, which hides problems πŸ™ˆ

I would decline PRs to @tsconfig/ember for this change, as I think it's not something library authors should ever enable, and something appdevs could enable, knowing the risks.

from data.

runspired avatar runspired commented on September 27, 2024

@NullVoxPopuli then the default for Ember apps will be that typechecking fails πŸ€·πŸ»β€β™‚οΈ

its literally impossible to not ship broken types. tsc strips @ts-expect-error and @ts-ignore-error from dts files, and it creates dts files for untyped code that are horribly broken when you generate the types for what code actually is typed.

from data.

runspired avatar runspired commented on September 27, 2024

also its just literally never a good idea to have skipLibCheck: false, tbh its shocking typescript hasn't removed the feature. Setting it to false tanks your performance, doesn't work with monorepos, and leaves you highly susceptible to semver drift breaking builds while offering no improved type safety or checks.

from data.

NullVoxPopuli avatar NullVoxPopuli commented on September 27, 2024

why is a library shipping with expect/ignore error tho? or trying to? I feel like there is some context I don't understand where there are broken types somewhere in the dep graph, and a library is trying to paper over the problem with those directives?

My main concern is silent fallback to any from libraries and libraries' internal types (some deep library types are wrong). as long as that doesn't happen, I'm happy with whatever the config ends up being.

from data.

runspired avatar runspired commented on September 27, 2024

My main concern is silent fallback to any from libraries and libraries' internal types (some deep library types are wrong). as long as that doesn't happen, I'm happy with whatever the config ends up being.

this is both something no app can ever fix and will happen anyway regardless, so its not worth it even yelling at you by default. tsc by-default produces any or types that resolve to any for tons of types. Especially if you use jsdoc, it prefers jsdoc to actual type information and creates non-existent symbols for non-existent types.

from data.

runspired avatar runspired commented on September 27, 2024

why is a library shipping with expect/ignore error tho?

also because good libraries care about shipping correct-for-consumer types, which means they have to use ts-expect-error in order to produce the correct type.

from data.

NullVoxPopuli avatar NullVoxPopuli commented on September 27, 2024

you probably want to cast to unknown as TheTypeYouReallyWant as ts-expect-error has never worked for libraries -- just not an option πŸ˜…

from data.

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.