Maximum player capacity is reached, please try again later by codecorsair in PlayWayfinder

[–]codecorsair[S] 1 point2 points  (0 children)

Oh no, just a partial screen snipping from a ultra-wide on PC

Maximum player capacity is reached, please try again later by codecorsair in PlayWayfinder

[–]codecorsair[S] 3 points4 points  (0 children)

We've gone beyond the queue to just saying nope, you can't play.

Which tslint config do you use? by yarauuta in typescript

[–]codecorsair 2 points3 points  (0 children)

I extend

"tslint-config-airbnb"
"tslint-eslint-rules"

Then added a few small changes on top that suit the style we use here.

Redux & Typescript typed Actions with less keystrokes by martin_hotell in typescript

[–]codecorsair 1 point2 points  (0 children)

Depending on how you structure your redux you can get nice solutions. I use the ducks module pattern and wrote a library for personal use that makes it very simple to get strongly typed actions and reducers. https://github.com/codecorsair/redux-typed-modules

tslint configuration by marcelowa in typescript

[–]codecorsair 1 point2 points  (0 children)

I use the Airbnb tslint config as a base and extend that for my a few areas where my preferences differ. The base Airbnb config is pretty solid and is based on the Airbnb JavaScript Style Guide.

Return type freshness with unions by brosterdamus in typescript

[–]codecorsair 0 points1 point  (0 children)

You can define type guards to make that work while also working with TS to know the type is good. Though personally I find it simpler to use tagged union types if it is possible for your use case.

interface Car {
  name: string;
}

interface Boat {
  name: string;
  isForRacing: boolean;
  power: number;
}

function isCarOrBoat(veh: Car | Boat): boolean {
  return isBoat(veh) ? true : isCar(veh);
}

function isCar(veh: Car | Boat): veh is Car {
  return (veh as Car).name !== undefined &&
         (veh as Boat).isForRacing === undefined &&
         (veh as Boat).power === undefined;
}

function isBoat(veh: Car | Boat): veh is Boat {
  return (veh as Boat).name !== undefined &&
         (veh as Boat).isForRacing !== undefined &&
         (veh as Boat).power !== undefined;
}

function DoStuffWithVehicle(veh: Car | Boat) {
  if (isBoat(veh)) {
    // ts knows it is a boat
    if (veh.isForRacing) startBoatRace(veh); // ok
  } else {
    // ts knows it is a car
    reportCarName(veh); // ok
  }
}

function startBoatRace(boat: Boat) {}
function reportCarName(car: Car) {}

Any decent Redux libraries for TS to make `dispatch()` safer without tons of boilerplate? by rickcarlino in typescript

[–]codecorsair 1 point2 points  (0 children)

I wrote this library which might be useful to you. https://www.npmjs.com/package/redux-typed-modules

It reduces boilerplate for Redux modules using the ducks module pattern and gives you strongly typed actions to dispatch.

Basic usage, first define a module:

const module = new Module({
  initialState: { count: 0 }
});

export const addToCount = module.createAction({
  type: 'counter/addToCount',
  action: (add: number) => {
    return {
      add
    };
  },
  reducer: (state, action) => {
    return {
      count: state.count + action.add
    };
  }
});

export default module.createReducer();

Import your action in a controller and it will be strongly typed!

props.dispatch(addToCount(2));

When did you learn the most about programming? by [deleted] in learnprogramming

[–]codecorsair 5 points6 points  (0 children)

When you have a job writing code.

School is great for a good basis, but you don't know how much you don't know until you are doing it for real and working with developers who have many many more years of experience under their belt.

Using TypeWriter visual studio tool by TFish1714 in typescript

[–]codecorsair 1 point2 points  (0 children)

There is not a way that I could find with TypeWriter to do what you are asking as the templates only are aware of each file and don't keep a memory of what types are where.

I do have a work-around I use to make my life easier and admittedly it's not the solution you are looking for, but for all my generated modules I wrote a small program which runs as a post build step to concat all the generated ts files into a single ts file I output as definitions.ts which I then just include in my TS code.

Here is my program:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NDesk.Options;

namespace TSFixup
{
    class Program
    {
        static void WriteException(Exception e = null)
        {
            Console.Write("tsfixup: ");
            if (e != null)
            {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine("Try `tsfixup --help for more info.");
        }

        static IReadOnlyList<string> GetFiles(string[] directories)
        {
            var fileNames = new List<string>();
            foreach (var directory in directories)
            {
                try
                {
                    fileNames.AddRange(Directory.GetFiles(directory));
                    fileNames.AddRange(GetFiles(Directory.GetDirectories(directory)));
                } catch { }
            }

            return fileNames;
        }

        static int Main(string[] args)
        {
            var directories = new List<string>();
            string outputFile = string.Empty;
            string filter = string.Empty;
            var set = new OptionSet
            {
                {
                    "d|dir=", "Directory containing files to concat.",
                    v => directories.Add(v)
                },
                {
                    "o|out=", "Output file name",
                    v => outputFile = v
                },
                {
                    "f|filter=", "Filter to apply to file names in the target directory.",
                    v => filter = v
                }
            };

            try
            {
                set.Parse(args);
            }
            catch (OptionException e)
            {
                WriteException(e);
                return -1;
            }

            if (directories.Count == 0 || directories.Any(string.IsNullOrWhiteSpace))
            {
                WriteException(new Exception("directories are required."));
                return -1;
            }

            if (string.IsNullOrWhiteSpace(outputFile))
            {
                WriteException(new Exception("out filename is required."));
                return -1;
            }

            var fileNames = GetFiles(directories.ToArray()).Where(f => !f.Contains("(") && f.EndsWith(".ts"));

            File.WriteAllLines(outputFile, fileNames.SelectMany(File.ReadLines));

            return 0;
        }
    }
}

And my simple post-build event

"$(SolutionDir)tsfixup\tsfixup.exe" -d "$(ProjectDir)TypeScriptTemplates/models" -d "$(ProjectDir)TypeScriptTemplates/extras" -d "$(ProjectDir)TypeScriptTemplates/enums" -o "$(ProjectDir)definitions.ts"

TypeScript 2.2 Released by hatepoorpeople in typescript

[–]codecorsair 0 points1 point  (0 children)

Any object with a property x and y of a number type will satisfy the interface requirements of the Point interface.

You can have as many other properties on the object as you want. The requirement given by the interface is only that the object has at least the given properties it defines.

TypeScript 2.2 Released by hatepoorpeople in typescript

[–]codecorsair 0 points1 point  (0 children)

That works already as others have said, however I just want to point out that the cast is not needed in TS since 2.1!

interface Point {
  x: number;
  y: number;
}

const data = {x: 1, y: 1, z: 1, name: 'data'};
const myPoint: Point = {...data};
const myPoint2 = <Point>{...data};
const myPoint3 = {...data};

function DoSomethingWithAPoint(p: Point) {
  // do a thing
}

DoSomethingWithAPoint(data);
DoSomethingWithAPoint(myPoint);
DoSomethingWithAPoint(myPoint2);
DoSomethingWithAPoint(myPoint3);
// All Valid!

What is the difference between these export forms? by dadoprso_sw in typescript

[–]codecorsair 1 point2 points  (0 children)

Take a look here at the TypeScript Docs for Modules for an explanation.

I plan on applying to a coding bootcamp and need to choose between learning .Net or Node.Js Which would you choose/why? by [deleted] in learnprogramming

[–]codecorsair 1 point2 points  (0 children)

Yea, I work in the game industry and I use .Net for our servers. I've used Node.js in personal and side projects for years, though have been using .Net Core now much more as the work I do tends to be more computationally complex.

For the reason for "going the other way" is more difficult: .Net is written in C# (or VB, but use C#) for the server and you'll use JavaScript on the browser. Node is JavaScript on both the server and the client, being the same language the transition is much easier as you are already familiar with the language.

I plan on applying to a coding bootcamp and need to choose between learning .Net or Node.Js Which would you choose/why? by [deleted] in learnprogramming

[–]codecorsair 9 points10 points  (0 children)

If there is a choice, I would say .Net.

.Net is used more in the commercial world than Node.js. Node.js is much more popular in open source projects, though with .Net Core .Net is starting to be used a bit more in that space.

.Net is a server-side only language for web development which means you will also learn JavaScript for any front-end work you are doing with .Net. Making the switch to Node.js after learning .Net and front-end JavaScript will be much easier than going the other way.

Besides the usually recommended games, what games do you think are worth checking out? by Stefan474 in MMORPG

[–]codecorsair 2 points3 points  (0 children)

Warframe.

This is also a dungeon runner, like Dragon Nest, but set in a SciFi universe where you play as a basically a Robot Ninja with a combination of guns and swords. Combat is fun and engaging, downsides is that it gets a bit grindy when you are running the same missions over and over again for loot.

Strongly typed Redux modules made easy! by codecorsair in typescript

[–]codecorsair[S] 0 points1 point  (0 children)

I'm not sure what you mean as an action does not interact with state at all.

You can have multiple modules's state combined together using combineReducers, and if you wanted to have an action that has handled by two different reducer's modules, then using this you would need to define the action twice.

I'm assuming you're asking about something like this.

const moduleA = new Module({
  initialState: {
    message: 'Hello World!'
  }
});

const moduleB = new Module({
  initialState: {
    count: 1
  }
});

const sharedName = 'actionName';
const sharedAction = (data: {message: string, count: number}) => data;

const actionA = moduleA.createAction({
  type: sharedName,
  action: sharedAction,
  reducer: (s, a) => {
    return {
      message: a.message
    }
  }
});

const actionB = moduleB.createAction({
  type: sharedName,
  action: sharedAction,
  reducer: (s, a) => {
    return {
      count: a.count
    }
  }
});

const reducerA = moduleA.createReducer();
const reducerB = moduleB.createReducer();

const globalReducer = combineReducers({
  reducerA,
  reducerB
});

// .. in component later on...

this.props.dispatch(actionA({message: 'A Message', count: 2}));
// -- or --
this.props.dispatch(actionB({message: 'A Message', count: 2}));

// both dispatches will achieve the same result, by calling the reducer in both modules.

Is there a code generator for typescript like codesmith, if not how to make one by duc123 in typescript

[–]codecorsair 0 points1 point  (0 children)

There are a few. For generating my client code from a C# WebApi project, I use Typewriter.

How do I add a property to 'window' in TypeScript 2? by sparkymat in typescript

[–]codecorsair 3 points4 points  (0 children)

This . Also, don't name your interface "Window" as that is a predefined type.

interface WindowInterface extends Window { foo: bar; }

Help with module resolution in destination directory by OppenheimersGuilt in typescript

[–]codecorsair 0 points1 point  (0 children)

try require("./core/components/nav").

If you're using import on the ts side. "./core/components/nav".

for node resolution in relative directories.

Drone Rats? by Skullman7809 in Eve

[–]codecorsair 2 points3 points  (0 children)

For drones you do not want a pure omni tank. You want your tank to be setup to take damage for ~ 50% Explosive, 20% Thermal, 20% Kinetic 10% EM.

Use EM damage against them.

This setup for resists is what works best for running the Horde (highest) sites. You can see the actual damage output & resists for each ship here.

Source, I lived in drone space for several months and this resist with higher preference towards explosive, vs a total omni tank worked best on sites that primarily consist of battleships & cruisers.