Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

view-transitions-api-types

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

view-transitions-api-types

Type definitions for the View Transitions API

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
101
decreased by-33.99%
Maintainers
1
Weekly downloads
 
Created
Source

View Transitions API Types

npm

Type definition for View Transitions API

Install

$ npm i -D view-transitions-api-types

Usage

Make types visible in specific files

Add a TypesScript triple-slash directive as follows in any code-containing '.ts' file you want these types to be available in:

// Add types for document.startViewTransition for use in this file. See https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-types- for more info.
/// <reference types="view-transitions-api-types" />

console.log(document.startViewTransition) // no type error!
Make types visible globally in all source files within a project

Create a .d.ts file anywhere in your project so that it is visible to TypeScript according to your tsconfig.json settings. For example, it could be at src/global.d.ts or src/view-transitions-api-types.d.ts.

Add a TypesScript triple-slash directive as follows:

// Add types for document.startViewTransition ambiently for implicit use in the entire project. See https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-types- for more info.
/// <reference types="view-transitions-api-types" />

This exposes the types ambiently so they are available without any import or require statements. TypeScript will simply know about them everywhere.

Important: do not add any import or export statements to this file, or it will stop working ambiently. Doing that changes it in TypeScript's view from a "script" to a "module", and the rules about ambient types change in that case.

License

This project is licensed under the MIT License.

Keywords

FAQs

Package last updated on 13 Jun 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc