- tsconfig.json
- {
- "compilerOptions": {
- "target": "es6",
- "module": "es6",
- "sourceMap": true
- }
- }
- main.ts
- import * as d3 from "d3";
- function main() : void {
- console.log('hi');
- //let rowsNumber = 1;
- //let rows = new Array<number>(rowsNumber);
- //for (let i = 0; i < rowsNumber; ++i)
- // rows[i] = i;
- d3.select('body').selectAll('.rows')
- .data([0, 1, 2]).enter()
- .text((data, index) => index.toString());
- // const div = document.createElement('div');
- // div.textContent = 'Hello';
- // document.body.appendChild(div);
- }
- document.addEventListener("DOMContentLoaded", (e) => main());
- index.html
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <script type="module">
- import './main.js';
- </script>
- <title>Testing TypeScript</title>
- </head>
- <body>
- </body>
- </html>
testing ts
By: kostja | Date: Nov 17 2017 21:07 | Format: None | Expires: never | Size: 1005 B | Hits: 727
Latest pastes
1 hours ago
11 hours ago
1 days ago
2 days ago
2 days ago