@adam-nielsen: Everything looks good here. I am ready to merge this PR (at 1c2ec97) on your behalf whenever you think it's ready.
If you'd like that to happen, please post a comment saying:
Ready to merge
and I'll merge this PR almost instantly. Thanks for helping out! :heart:
(@paulschwoerer: you can do this too.)
🤖 Merge PR #64172 Allow spritesmith types import by @Zenoo
fix: Allow spritesmith types import
fix: Add a test for new types import for spritesmith
Please fill in this template.
npm test <package to test>
.Select one of these and delete the others:
If changing an existing definition:
Ready to merge
@Zenoo: Everything looks good here. I am ready to merge this PR (at 5ae2616) on your behalf whenever you think it's ready.
If you'd like that to happen, please post a comment saying:
Ready to merge
and I'll merge this PR almost instantly. Thanks for helping out! :heart:
🤖 Merge PR #64156 jws support 'json' option for decode by @loucadufault
This is supported in the library but not by the types: https://github.com/auth0/node-jws/blob/master/index.js#L15
This is supported in the library but not by the types: https://github.com/auth0/node-jws/blob/master/index.js#L15
Please fill in this template.
npm test <package to test>
.Select one of these and delete the others:
If changing an existing definition:
Ready to merge
Using full words in the support table for better accessibility (#64170)
🔔 @Zenoo — you're the only owner, but it would still be good if you find someone to review this PR in the next few days, otherwise a maintainer will look at it. (And if you do find someone, maybe even recruit them to be a second owner to make future changes easier...)
Please fill in this template.
npm test <package to test>
.Select one of these and delete the others:
If changing an existing definition:
@Zenoo Thank you for submitting this PR!
This is a live comment which I will keep updated.
Because you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it.
You can test the changes of this PR in the Playground.
Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.
{
"type": "info",
"now": "-",
"pr_number": 64172,
"author": "Zenoo",
"headCommitOid": "5ae2616e442581cf3b9219e727d6a7e684b22d65",
"mergeBaseOid": "0d20e71271c585986b5830f2e0866a011d96c7e6",
"lastPushDate": "2023-01-31T21:25:11.000Z",
"lastActivityDate": "2023-01-31T21:26:28.000Z",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Well-liked by everyone",
"pkgInfo": [
{
"name": "spritesmith",
"kind": "edit",
"files": [
{
"path": "types/spritesmith/index.d.ts",
"kind": "definition"
},
{
"path": "types/spritesmith/spritesmith-tests.ts",
"kind": "test"
}
],
"owners": [
"Zenoo"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Well-liked by everyone"
}
],
"reviews": [],
"ciResult": "unknown"
}
Please fill in this template.
npm test <package to test>
.Select one of these and delete the others:
If changing an existing definition:
Thanks ! I will open a PR with these modifications
here you are, put your types into 'namespace' to export, rewritten:
// Type definitions for spritesmith 3.4
// Project: https://github.com/twolfson/spritesmith
// Definitions by: Zenoo <https://github.com/Zenoo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { ReadableStream } from 'stream/web';
import { BufferFile } from 'vinyl';
declare class Spritesmith {
constructor(params?: Spritesmith.SpritesmithParams);
static run(
params: Spritesmith.SpritesmithParams & Spritesmith.SpritesmithProcessImagesOptions & {
src: Spritesmith.SpritesmithCreateImagesSrc;
},
callback: (
err: Error | null,
result: Spritesmith.SpritesmithResult & {
image: Buffer;
}
) => void): void;
createImages(src: Spritesmith.SpritesmithCreateImagesSrc, callback: (err: Error | null, images: SpritesmithImage[]) => void): void;
processImages(
images: Spritesmith.SpritesmithImage[],
options?: Spritesmith.SpritesmithProcessImagesOptions
): Spritesmith.SpritesmithResult;
}
declare namespace Spritesmith {
interface SpritesmithParams {
engine?: string;
engineOpts?: Record<string, unknown>;
}
type SpritesmithCreateImagesSrc = Array<string | BufferFile>;
interface SpritesmithImage {
width: number;
height: number;
[key: string]: unknown;
}
interface SpritesmithProcessImagesOptions {
padding?: number;
exportOpts?: {
format?: 'png' | 'jpg' | 'jpeg' | 'webp';
quality?: number;
background?: string;
[key: string]: unknown;
};
algorithm?: 'top-down' | 'left-right' | 'diagonal' | 'alt-diagonal' | 'binary-tree';
algorithmOpts?: {
sort?: boolean;
};
}
interface SpritesmithResult {
image: ReadableStream;
coordinates: Record<string, { x: number; y: number; width: number; height: number }>;
properties: { width: number; height: number };
}
}
export = Spritesmith;
usage, e.g.:
import Spritesmith, {
SpritesmithCreateImagesSrc,
SpritesmithImage,
SpritesmithParams,
SpritesmithProcessImagesOptions,
SpritesmithResult
} from 'spritesmith';
No, I mean, people need to be able to import the every type declared here for use elsewhere.
If for some reason I need to give the type SpritesmithResult
to some variable like:
let result: SpritesmithResult | null = null;
It's not possible, since there is no way to import the type SpritesmithResult
from the declaration
If one has default (for new TS configs) esModuleInterop
option enabled, this works:
import Spritesmith from 'spritesmith';
const sprites = ['fork.png', 'github.png', 'twitter.png'];
Spritesmith.run({ src: sprites }, function handleResult(err, result) {
result.image;
result.coordinates;
result.properties;
});
producing:
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const spritesmith_1 = __importDefault(require("spritesmith"));
const sprites = ['fork.png', 'github.png', 'twitter.png'];
spritesmith_1.default.run({ src: sprites }, function handleResult(err, result) {
result.image;
result.coordinates;
result.properties;
});