jimp-dev / jimp-dev/jimp

Jimp.write(path) has weird typescript type `${string}.${Extension}`

Open
#1,349 2 comments 4 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
14.7k
Forks
777
PR merge metrics
No merged PRs in 30d

Description

# Expected Behavior

I expect standard `string` as datatype of `path` input parameter of `Jimp.write` function.

# Current Behavior

Used complicated (and on many places incompatible) data type`${string}.${Extension}` for input parameter `path`.

Need to explicitly retype by ugly `as '${string}.${string}'`

# Failure Information (for bugs)

N/A

## Steps to Reproduce

```
const icon = await Jimp.read(sourceImgPath);
const writePath = path.join(__dirname, 'myfile.png');
await icon.write(writePath); // Error: Argument of type 'string' is not assignable to parameter of type '`${string}.${string}`'.ts(2345)
```

**Screenshots**

N/A

## Context

- Jimp Version: 1.6.0
- Operating System: MaOS
- Node version: 20.x

## Failure Logs

```
Error: Argument of type 'string' is not assignable to parameter of type '`${string}.${string}`'.ts(2345)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.