Fix some issues with TS compiler

This commit is contained in:
Florent 2021-02-13 17:40:22 +01:00 committed by Florent F
parent 40fe0eeb2d
commit 748113ddb0
7 changed files with 29 additions and 12 deletions

View File

@ -4,7 +4,8 @@
"description": "A lightweight library to give some additions for the [rss-parser package](https://github.com/rbren/rss-parser).",
"main": "index.js",
"scripts": {
"test": "mocha --require ts-node/register ./tests/**/*-spec.ts"
"test": "mocha --require ts-node/register ./tests/**/*-spec.ts",
"build": "tsc -p ./src"
},
"repository": {
"type": "git",

View File

@ -1,4 +1,4 @@
class ListenerRSSInfos {
export default class ListenerRSSInfos {
_name: string = ""; // name of the listener
_address: string = ""; // feed's address
_timeloop: number | undefined = 5 * 60; // update time RSS feed
@ -42,5 +42,3 @@ class ListenerRSSInfos {
return this._customfields;
}
}
module.exports = ListenerRSSInfos;

View File

@ -1,4 +1,4 @@
import ListenerRss from "./listener-rss.ts";
import ListenerRss from "./listener-rss";
import ListenerRSSInfo from "./Models/ListenerRSSInfos";
// TODO J'ai des erreurs sur les imports, que je ne comprend pas trop

View File

@ -1,11 +1,11 @@
import Parser from "rss-parser";
import { ListenerRSSInfo as ListenerInfo } from "./Models/ListenerRSSInfos";
import ListenerInfo from "./Models/ListenerRSSInfos";
const DEFAULT_TIMELOOP = 5 * 60; // default timeloop is 5 min
class ListenerRss {
name = undefined;
address = undefined;
export default class ListenerRss {
name = "";
address = "";
timeloop = DEFAULT_TIMELOOP; // time in seconds
customfields = [];
@ -93,5 +93,3 @@ class ListenerRss {
this.loopRunning = false;
}
}
module.exports = ListenerRss;

10
src/tsconfig.json Normal file
View File

@ -0,0 +1,10 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"moduleResolution": "node"
},
"exclude": [
"build/",
"node_modules"
]
}

6
tests/tsconfig.json Normal file
View File

@ -0,0 +1,6 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs"
}
}

View File

@ -13,5 +13,9 @@
"resolveJsonModule": false,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
},
"exclude": [
"build/",
"node_modules"
]
}