benjamn / benjamn/ast-types

Simple example of how to use the builders and namedTypes in Typescript.

Open
#324 1 comment 0 reactions 1 assignee Claimed by @benjamn View on GitHub
Dominant language
TypeScript
Stars
1.2k
Forks
194
Avg merge
22h 43m
Merged PRs (30d)
10

Description

Being new to Typescript I'm having a lot of problems trying to figure out how to use ast-types. I have been using ast-types with plain nodejs by following the example on the docs.

example
```nodejs

var n = require("ast-types").namedTypes;
var b = require("ast-types").builders;

var fooId = b.identifier("foo");

```

However, when I try to use it on Typescript I can't seem to figure out how to get the builders and namedTypes imported with Typescript.

I've tried these combinations

```nodejs
#This example only exports the types.
import {Builders, NamedType} from "ast-types"

#I tried this combination to get the builders, and no luck.
import * as astTypes from "ast-types"
console.log(astTypes.builders)

```

I really just want a simple easy 2-5 line example that shows me how to use ast-types in Typescript as I'm already doing it on Nodejs.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.