Skip to content

Enums should be exported as values #60

@ViliamKopecky

Description

@ViliamKopecky

Summary

Enums should be exported as values - not only as types.

// this works, but is bad
import { type PaymentStatus } from '@stripe/terminal-js/pure'
const bad = terminal.getPaymentStatus() === ('waiting_for_input' as PaymentStatus)
// this throws error, but should work
import { PaymentStatus } from '@stripe/terminal-js/pure'
const good = terminal.getPaymentStatus() === PaymentStatus.WAITING_FOR_INPUT)

// TypeError: Cannot read properties of undefined (reading 'WAITING_FOR_INPUT')

Other information

Small repo that should work, but throws error:

https://codesandbox.io/s/competent-cloud-xku665?file=/src/index.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions