GithubHelp home page GithubHelp logo

Comments (18)

benasher44 avatar benasher44 commented on May 25, 2024 4

The PR was merged, and a release was tagged: https://github.com/typestack/class-validator/releases/tag/v0.14.1

I expect there will be an updated package available soon.

from definitelytyped.

kabamrrichman avatar kabamrrichman commented on May 25, 2024 1

Thanks! And does your project have any other dependencies on @types/validator? Like does it have multiple versions installed?

Googled this issue, and it looks like people have run into this issue over the years (even with class-validator specifically) with multiple versions with slightly incompatible definitions installed.

Only [email protected] and @types/[email protected] (13.11.8 when issue occurred)

from definitelytyped.

marcovanetti avatar marcovanetti commented on May 25, 2024 1

We fixed our projects adding to the package.json

"overrides": {
    "@types/validator": "13.11.7"
 }

we know it's a temporary solution until the bug is fixed.

from definitelytyped.

benasher44 avatar benasher44 commented on May 25, 2024 1

Hey folks. After some discussing on the PR, there isn't a way forward that both supplies the needed missing type information that was solved by #68121 and supports the specific style of import being used by class-validator. I have opened a downstream PR here: typestack/class-validator#2360

From looking at the class-validator project's issues, it looks like this flavor of issue has come up in the past, so this PR should fix it permanently.

from definitelytyped.

benasher44 avatar benasher44 commented on May 25, 2024 1

0.14.1 is now available on npm. I believe this issue can now be closed

from definitelytyped.

benasher44 avatar benasher44 commented on May 25, 2024

@kabamrrichman apologies! I'll take a look and work on a fix ASAP

from definitelytyped.

benasher44 avatar benasher44 commented on May 25, 2024

It looks like it's failing in class-validator package. What version are you using, so I can test?

from definitelytyped.

benasher44 avatar benasher44 commented on May 25, 2024

@kabamrrichman could you also share your TypeScript version? It looks like that package is just doing a default import, which is covered by tests:

import validator from "validator";

from definitelytyped.

benasher44 avatar benasher44 commented on May 25, 2024

tsconfig.json would be great too!

from definitelytyped.

kabamrrichman avatar kabamrrichman commented on May 25, 2024

[email protected]
[email protected]

"compilerOptions": {
	"module": "commonjs",
	"esModuleInterop": true,
	"moduleResolution":"Node",
	"target": "ES6",
	"noImplicitAny": true,
	"sourceMap": true,
	"allowJs": true,
	"allowSyntheticDefaultImports": true,
	"strict": true,
	"forceConsistentCasingInFileNames": true,
	"resolveJsonModule": true,
	"isolatedModules": true,
	"declaration": true,
	"outDir": "./dist",
	"noUncheckedIndexedAccess": true
}

from definitelytyped.

benasher44 avatar benasher44 commented on May 25, 2024

Thanks! And does your project have any other dependencies on @types/validator? Like does it have multiple versions installed?

Googled this issue, and it looks like people have run into this issue over the years (even with class-validator specifically) with multiple versions with slightly incompatible definitions installed.

from definitelytyped.

dineshneoito avatar dineshneoito commented on May 25, 2024

Issue happened due to bf9914f. In types/validator/index.d.ts, exporting is changed but not handled in validator package. with earlier version "@types/validator": "13.11.7", it will work.

from definitelytyped.

benasher44 avatar benasher44 commented on May 25, 2024

@dineshneoito the validator package isn't aware of these types at all. In general, @types packages are a promise that the backing JS package has a certain contract.

I'll try to repro today. It's a strange error because validator types have never had a namespace called ValidatorJS

from definitelytyped.

benasher44 avatar benasher44 commented on May 25, 2024

@marcovanetti @dineshneoito if you could also provide your tsconfig and TS versions, that would be great

from definitelytyped.

kabamrrichman avatar kabamrrichman commented on May 25, 2024

Is it possible to roll back this change and re-do it as a major version increase for @types/validator?
class-validator 0.14.0 has this dep: "@types/validator": "^13.9.0"

from definitelytyped.

benasher44 avatar benasher44 commented on May 25, 2024

I don't think so. Major bump would imply a new version of validator as well.

from definitelytyped.

kabamrrichman avatar kabamrrichman commented on May 25, 2024

To confirm, the choice is to let new installs of class-validator 0.14.0 to fail during builds and the solution is to wait until a new version of class-validator is released with your upstream changes?

from definitelytyped.

benasher44 avatar benasher44 commented on May 25, 2024

For the most part, types packages track their backing package major version and aren't versioned independently.

Generally speaking, @types packages can break without major version bumps. For example, next month this repo is scheduled to drop support for TS 4.6, which will not result in a major version bump of all @types packages. Going forward, packages could start using TS features only in 4.7+ without a major version bump, which could in fact break fresh installs.

For this reason, it's best practice use lock files. npm overrides / yarn package resolutions are also good tools here.

from definitelytyped.

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.