Skip to content

Commit

Permalink
Replace tsx with experimental-strip-types
Browse files Browse the repository at this point in the history
  • Loading branch information
lentz committed Feb 2, 2025
1 parent 34e833c commit 889fe6d
Show file tree
Hide file tree
Showing 16 changed files with 1,928 additions and 2,430 deletions.
6 changes: 3 additions & 3 deletions Notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { readFileSync } from 'fs';
import handlebars from 'handlebars';
import sgMail, { MailService } from '@sendgrid/mail';

import { ILeague, IUser } from './User.js';
import config from './config.js';
import { IPlayer, ITransaction } from './transactions.js';
import type { ILeague, IUser } from './User.ts';
import config from './config.ts';
import type { IPlayer, ITransaction } from './transactions.ts';

sgMail.setApiKey(config.SENDGRID_API_KEY);

Expand Down
4 changes: 2 additions & 2 deletions User.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as mongoose from 'mongoose';
import mongooseEncryption from 'mongoose-encryption';

import config from './config.js';
import yahooAuth from './yahooAuth.js';
import config from './config.ts';
import yahooAuth from './yahooAuth.ts';

export interface ILeague {
key: string;
Expand Down
4 changes: 2 additions & 2 deletions __tests__/Notification.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, expect, it, vi } from 'vitest';

vi.mock('../config.js', () => ({
vi.mock('../config.ts', () => ({
default: { SENDGRID_API_KEY: 'SG.TESTKEY' },
}));

import Notification from '../Notification.js';
import Notification from '../Notification.ts';

describe('notification', () => {
const mockUser = { id: '123', email: '[email protected]' };
Expand Down
12 changes: 6 additions & 6 deletions __tests__/controller.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { describe, expect, it, vi } from 'vitest';

vi.mock('../config.js', () => ({
vi.mock('../config.ts', () => ({
default: {},
}));

import * as controller from '../controller.js';
import User from '../User.js';
import * as leagues from '../leagues.js';
import yahooAuth from '../yahooAuth.js';
import * as controller from '../controller.ts';
import User from '../User.ts';
import * as leagues from '../leagues.ts';
import yahooAuth from '../yahooAuth.ts';

vi.mock('../yahooAuth.js');
vi.mock('../yahooAuth.ts');

const mockRes = {
render: vi.fn(),
Expand Down
2 changes: 1 addition & 1 deletion __tests__/leagues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFileSync } from 'fs';

import { describe, expect, it } from 'vitest';

import * as leagues from '../leagues.js';
import * as leagues from '../leagues.ts';

describe('leagues', () => {
const mockYahooUser = readFileSync('./__tests__/mockYahooUser.json', 'utf8');
Expand Down
2 changes: 1 addition & 1 deletion __tests__/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFileSync } from 'fs';

import { describe, expect, it } from 'vitest';

import { filterNew, getAll } from '../transactions.js';
import { filterNew, getAll } from '../transactions.ts';

describe('transactions', () => {
const mockLeague = { name: 'league', lastNotifiedTransaction: '2' };
Expand Down
6 changes: 3 additions & 3 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import helmet from 'helmet';
import morgan from 'morgan';
import * as handlebarsExpress from 'express-handlebars';

import './db.js';
import config from './config.js';
import * as controller from './controller.js';
import './db.ts';
import config from './config.ts';
import * as controller from './controller.ts';

const app = express();

Expand Down
10 changes: 5 additions & 5 deletions checkLeagues.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env node

import db from './db.js';
import Notification from './Notification.js';
import * as leagues from './leagues.js';
import * as transactions from './transactions.js';
import User from './User.js';
import db from './db.ts';
import Notification from './Notification.ts';
import * as leagues from './leagues.ts';
import * as transactions from './transactions.ts';
import User from './User.ts';

const users = await User.find().sort({ updatedAt: 1 }).exec();

Expand Down
8 changes: 4 additions & 4 deletions controller.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NextFunction, Request, Response } from 'express';
import type { NextFunction, Request, Response } from 'express';
import mongoose from 'mongoose';

import User from './User.js';
import * as leagues from './leagues.js';
import yahooAuth from './yahooAuth.js';
import User from './User.ts';
import * as leagues from './leagues.ts';
import yahooAuth from './yahooAuth.ts';

export async function index(_req: Request, res: Response) {
res.render('index');
Expand Down
2 changes: 1 addition & 1 deletion db.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import mongoose from 'mongoose';

import config from './config.js';
import config from './config.ts';

mongoose.set('strictQuery', true);
mongoose.connect(config.MONGODB_URI);
Expand Down
2 changes: 1 addition & 1 deletion leagues.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IUser } from './User.js';
import type { IUser } from './User.ts';

interface IYahooLeague {
league: [
Expand Down
Loading

0 comments on commit 889fe6d

Please sign in to comment.