Skip to content

Test that the TypeScript files in our tests actually compile with tsc #56

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

Merged
merged 8 commits into from
Dec 4, 2017
Merged
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ target/
.classpath
.project
.settings/
/node_modules
/package-lock.json
11 changes: 10 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ scala: 2.12.3

jdk: oraclejdk8

script: sbt ++$TRAVIS_SCALA_VERSION samples/compile test
script:
- sbt ++$TRAVIS_SCALA_VERSION samples/compile test
- $(npm bin)/tsc samples/*.d.ts

before_cache:
# See http://www.scala-sbt.org/0.13/docs/Travis-CI-with-sbt.html
# Tricks to avoid unnecessary cache updates
- find $HOME/.sbt -name "*.lock" | xargs rm
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm

install:
- . $HOME/.nvm/nvm.sh
- nvm install 8
- nvm use 8
- npm install typescript@2.6.2

cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt/boot
- node_modules
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this standard practice? Is not dangerous? As in, if a new version of the CI script does not install some package anymore, it would still be in the cached node_modules/, and would therefore still be available, by accident?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the standard practice.
Caching Dependencies and Directories - Travis CI
The Travis CI Blog: Speed Up Your Builds: Cache Your Dependencies
But I can understand your concerns as well. Do you want to delete it?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK let's keep it that way, then.

10 changes: 10 additions & 0 deletions samples/assets/module.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
declare module "module" {
const value: any;
export const Single: any;
export const First: any;
export const Second: any;
export const Third: any;
export const Fourth: any;
export const Fifth: any;
export default value;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions samples/extendsobject.ts → samples/extendsobject.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// copy from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/index.d.ts
declare interface LoDashStatic {
at<T extends object>();
};

}
File renamed without changes.
16 changes: 16 additions & 0 deletions samples/import.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference path="./assets/module" />
// Import variants from https://www.typescriptlang.org/docs/handbook/modules.html#import

import Default from "module";
import { Single } from "module";
import { Single as Renamed } from "module";
import { First, Second } from "module";
import { Third as T, Fourth } from "module";
import * as validator from "module";
import "./assets/module";

declare const hello: String;

declare module mod {
export function f(x: Number): String;
}
File renamed without changes.
17 changes: 0 additions & 17 deletions samples/import.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion samples/overrides.ts → samples/overrides.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare module overrides {
toString(): string;
}

export class B extends BLike {
Copy link
Contributor Author

@kyo-ago kyo-ago Dec 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ $(npm bin)/tsc samples/*.ts
samples/overrides.d.ts(13,26): error TS2689: Cannot extend an interface 'BLike'. Did you mean 'implements'?

export class B implements BLike {
equals(other: any): boolean;
clone(): BLike;
toString(): string;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.