![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@types/long
Advanced tools
The @types/long package provides TypeScript type definitions for the long.js library, which is a comprehensive library for working with 64-bit integers. These type definitions enable TypeScript developers to use long.js in their projects with the benefits of TypeScript's static type checking. The long.js library itself allows for the representation, manipulation, and serialization of 64-bit integers, which are not natively supported in JavaScript due to its use of IEEE 754 floating-point numbers for all numeric values.
Creating long integers
This feature allows the creation of 64-bit integers. The code sample demonstrates how to create a long integer with the maximum signed positive value.
import * as Long from 'long';
let longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);
Arithmetic operations
This feature enables arithmetic operations such as addition, subtraction, multiplication, and division on 64-bit integers. The code sample shows how to add two Long instances.
import * as Long from 'long';
let longOne = Long.fromInt(1);
let longTwo = Long.fromInt(2);
let sum = longOne.add(longTwo);
Comparison
This feature allows for the comparison of long integers, including equality checks and relational comparisons. The code sample demonstrates checking if two Long instances are equal.
import * as Long from 'long';
let longOne = Long.fromInt(1);
let longTwo = Long.fromInt(2);
let isEqual = longOne.equals(longTwo);
Serialization
This feature supports the serialization of long integers to strings, which is useful for storage or transmission. The code sample shows how to serialize a Long instance to a string.
import * as Long from 'long';
let longVal = Long.fromInt(123456);
let serialized = longVal.toString();
The bignum package provides arbitrary-precision arithmetic operations. Unlike @types/long, which is focused on 64-bit integers, bignum supports numbers of any size, making it more flexible for applications requiring large number computations beyond 64 bits.
big-integer is another library for arbitrary-precision integer arithmetic. Similar to bignum, it offers more flexibility than @types/long for operations on very large integers. However, it might not be as optimized for 64-bit operations specifically.
npm install --save @types/long
This package contains type definitions for long.js (https://github.com/dcodeIO/long.js).
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/long
Additional Details
These definitions were written by Peter Kooijmans https://github.com/peterkooijmans.
FAQs
Stub TypeScript definitions entry for long, which provides its own types definitions
The npm package @types/long receives a total of 8,638,006 weekly downloads. As such, @types/long popularity was classified as popular.
We found that @types/long demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.