Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Typescript with Meteor 1.8 #103

Draft
wants to merge 3 commits into
base: typescript
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ before_install:
env:
# barbatus:typescript requires ecmascript and modules from 1.6.x, so we just
# use that to run the test
- CXX=g++-4.8 METEOR_RELEASE=1.6.1.4
- CXX=g++-4.8 METEOR_RELEASE=1.8.2-rc.7
addons:
apt:
sources:
Expand Down
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"esbenp.prettier-vscode"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
2 changes: 1 addition & 1 deletion lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/*
Server/client util files
*/
import * as moment from "moment";
import * as moment from "meteor/momentjs:moment";
import * as _ from "underscore";

export function formatMillis(millis) {
Expand Down
12 changes: 3 additions & 9 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ Npm.depends({
});

Package.onUse(function(api) {
api.versionsFrom("1.4.4.6");
api.versionsFrom("1.8.2-rc.7");

// TypeScript support
// Modules: https://docs.meteor.com/v1.4/packages/modules.html
api.use("modules");
api.use("ecmascript");
// Should be replaced with straight up built-in 'typescript' in Meteor 1.8.2
// adornis:typescript from [1.4, 1.8)
// api.use("adornis:[email protected]");
api.use("barbatus:[email protected]");
api.use("typescript");

// Client-only deps
api.use(["session", "ui", "templating", "reactive-var"], "client");
Expand Down Expand Up @@ -146,10 +143,7 @@ Package.onTest(function(api) {
// Need these specific versions for tests to agree to run
api.use("modules");
api.use("ecmascript");

// For compiling TS
api.use("barbatus:typescript");
// api.use("adornis:typescript");
api.use("typescript");

api.use([
"accounts-base",
Expand Down
2 changes: 1 addition & 1 deletion server/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as os from "os";
import * as merge from "deepmerge";
import merge from "deepmerge";

import { Meteor } from "meteor/meteor";

Expand Down
24 changes: 17 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": ["es2015", "dom"],
/* Basic Options */
"target": "es2018",
"module": "esNext",
"lib": ["esnext", "dom"],
"allowJs": true,
"checkJs": false,
"jsx": "preserve",
"incremental": true,
"noEmit": true,

/* Strict Type-Checking Options */
"strict": false,
"noImplicitAny": false,
"strictNullChecks": false,
"noImplicitAny": false, // TODO flip to true when ready
"strictNullChecks": false, // TODO flip to true when ready

/* Additional Checks */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": false,

/* Module Resolution Options */
"baseUrl": ".",
"paths": {
/* Support absolute /imports/* with a leading '/' */
"/*": ["*"]
},
"moduleResolution": "node",
"resolveJsonModule": true,
"types": ["node"],
"typeRoots": ["types/", "node_modules/@types"]
}
"typeRoots": ["types/", "node_modules/@types"],
"esModuleInterop": true,
"preserveSymlinks": true
},
"exclude": ["./.meteor/**", "./packages/**"]
}
2 changes: 2 additions & 0 deletions types/shims.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ declare module "meteor/tracker" {
declare module "meteor/mizzao:partitioner";
declare module "meteor/mizzao:user-status";

declare module "meteor/momentjs:moment";

// Old MTurk stuff
declare module "mturk-api";
declare module "jspath";
Expand Down