npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tsonic/dotnet-globals

v0.2.1

Published

Global type definitions for Tsonic dotnet mode (noLib: true)

Downloads

19

Readme

@tsonic/dotnet-globals

Global type definitions for Tsonic in dotnet mode.

Purpose

This package provides the minimal global/intrinsic types required by TypeScript when noLib: true is set, while preserving .NET semantics.

Key principle: In dotnet mode, JavaScript array/string methods are NOT available. Use BCL and LINQ instead.

Usage

Install this package in your Tsonic project:

npm install @tsonic/dotnet-globals

Add to your tsconfig.json:

{
  "compilerOptions": {
    "noLib": true,
    "types": ["@tsonic/dotnet-globals"]
  }
}

Set your tsonic.json mode (or omit for default):

{
  "mode": "dotnet"
}

What This Provides

Minimal Global Types

  • Array<T> - WITHOUT JS methods like .length, .map, .filter
  • String - WITHOUT JS methods like .slice, .includes
  • Number, Boolean, Object, Function - minimal definitions
  • Promise<T> - for async/await support
  • Iterator types - for for-of loops
  • Utility types - Partial, Readonly, Pick, etc.

What's NOT Included

  • No .length on arrays - use list.Count from BCL
  • No .map(), .filter(), etc. - use LINQ methods from System.Linq
  • No string instance methods - use BCL String static methods
  • No DOM types - no File, Document, HTMLElement, etc.
  • No Node.js types - no Buffer, process, etc.

Example

import { Console } from "System";
import { List } from "System.Collections.Generic";

// Array literals are List<T> compatible
const numbers = [1, 2, 3, 4, 5];

// ❌ ERROR: Property 'length' does not exist on type 'number[]'
// console.log(numbers.length);

// ✅ CORRECT: Use BCL List<T> methods
const list = new List<number>(numbers);
Console.WriteLine(list.Count); // 5

// ❌ ERROR: Property 'map' does not exist on type 'number[]'
// const doubled = numbers.map(x => x * 2);

// ✅ CORRECT: Use LINQ
import { Enumerable } from "System.Linq";
const doubled = Enumerable.Select(numbers, x => x * 2);

Mode Switching

To switch to JavaScript semantics (with .length, .map(), etc.), use @tsonic/js-globals instead:

  1. Uninstall this package: npm uninstall @tsonic/dotnet-globals
  2. Install JS globals: npm install @tsonic/js-globals
  3. Update tsconfig.json: "types": ["@tsonic/js-globals"]
  4. Update tsonic.json: "mode": "js"

License

MIT