jsdiff icon indicating copy to clipboard operation
jsdiff copied to clipboard

Type for Intl.Segmenter

Open BirgitPohl opened this issue 1 year ago • 2 comments

I'm installing yeoman

diff type

{
  "name": "generator-person",
  "version": "1.0.0",
  "description": ghjj",
  "license": "ISC",
  "author": "me",
  "type": "commonjs",
  "keywords": [
    "yeoman-generator"
  ],
  "files": [
    "generators"
  ],
  "main": "generators/index.js",
  "scripts": {
    "test": "test",
    "build": "npm run clean && tsc",
    "link": "npm link",
    "clean": "rm -rf generators"
  },
  "dependencies": {
    "ts-node": "^10.9.2",
    "typescript": "^5.7.2",
    "yeoman-generator": "^5.10.0"
  },
  "devDependencies": {
    "@types/yeoman-generator": "^5.2.14"
  }
}

When I

npm i
npm run build

I get an error, that

node_modules/@types/diff/index.d.ts:43:26 - error TS2694: Namespace 'Intl' has no exported member 'Segmenter'.

43     intlSegmenter?: Intl.Segmenter | undefined;

I wanted to report that here and not in definitely typed, because since you have added the support for this in 2024, you might want to check, if Intl has updated something that requires refactoring.

Currently, it blocks me.

BirgitPohl avatar Jan 08 '25 14:01 BirgitPohl

any update here?

updating my tsconfig.json to use es2022 for the lib fixed it for me. need to see what the general impact is though.

lsmith77 avatar Jan 23 '25 15:01 lsmith77

Related to #303

isaachinman avatar Feb 21 '25 08:02 isaachinman

Yeah, this happens if your compilation target is one for which Intl.Segmenter didn't yet exist. Interesting. I may try to address this once we're shipping our own TypeScript definitions instead of relying on DefinitelyTyped, but I don't actually know what the right approach to take here is, and will need to do some research.

ExplodingCabbage avatar Mar 17 '25 16:03 ExplodingCabbage