Giter VIP home page Giter VIP logo

Comments (3)

receiptline avatar receiptline commented on May 26, 2024

Thanks for using ReceiptIO!
As with receiptline we would like to add TypeScript typings.

from receiptio.

ryall avatar ryall commented on May 26, 2024

Here's a rough template for the ReceiptIO types:

declare module 'receiptio' {
  import { Transform } from 'node:stream';

  export type Printer =
    | 'escpos'
    | 'sii'
    | 'citizen'
    | 'fit'
    | 'impact'
    | 'impactb'
    | 'star'
    | 'starline'
    | 'emustarline'
    | 'stargraphic'
    | 'svg'
    | 'png';

  export type Language =
    | 'en'
    | 'fr'
    | 'de'
    | 'es'
    | 'po'
    | 'it'
    | 'ru'
    | 'ja'
    | 'ko'
    | 'zh-hans'
    | 'zh-hant'
    | string; // Not all are listed, so allow arbitrary for now

  export type PrintStatus =
    | 'success'
    | 'online'
    | 'coveropen'
    | 'paperempty'
    | 'error'
    | 'offline'
    | 'disconnect'
    | 'timeout';

  export function print(receiptmd: string, options?: string): PrintStatus;
  export function print(receiptmd: string, options?: string): string;

  export function createPrint(options?: string): Transform;
}

Not much I can do with the specific types as the options are passed as a string.

Any chance options could also be passed as an object? I will update the types for that.

from receiptio.

onurbamaro avatar onurbamaro commented on May 26, 2024

It is a really great library. It was hard to find something in js that worked well for printing.

It would be really lovely if it had types.

Awesome job anyway!

from receiptio.

Related Issues (7)

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.