Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Latest commit

 

History

History
27 lines (18 loc) · 1.03 KB

types.md

File metadata and controls

27 lines (18 loc) · 1.03 KB

cdk types and cdk-web's index.d.ts

if you are in a node-like environment, you do not need to read this guide. this is for users who include cdk-web directly by a <script> tag in their html.

npm

for your convenience, each cdk-web deployment package also includes a typings file (.d.ts) that allows you to have the same auto-complete and debugging features available to the native cdk. aws-cdk-lib, constructs, and cdk-web cli are also bundled and automatically included when you reference the typings file.

to get types working you need to reference the type file that is shipped by cdk-web after npm installing it.

/// <reference types="cdk-web" />

// this prints cdk version bundled with cdk-web
console.log(CDK.version);

// you should have typings here
const cdk = CDK.require('aws-cdk-lib')
const ec2 = CDK.require('aws-cdk-lib/aws-ec2')

note that the typings file is currently massive and might break your environment if you don't have a powerful machine.

npm