Here is a possible implementation using TypeScript:

```ts
export class LruCache<K, V> {
  private readonly cache: Map<K, V>; 
  constructor(readonly capacity: number) {
    if (capacity < 1 || !Number.isInteger(capacity)) {
      throw new Error('Capacity must be a positive integer');
    }
    this.cache = new Map();
  }

  get(key: K): V | undefined {
    const hasKey = this.cache.has(key);
    if (!hasKey) return;
    // Re-add the entry to bring it to front as it was recently used.
    const val = this.cache.get(key); 
    this.set(key, val);
    return val;
  }

  set(key: K, value: V) {
    if (this.cache.has(key)) {
      // The entry is already in the cache so just update it and re-add to bring it to front.
      this.cache.delete(key); 
    } else if (this.cache.size === this.capacity) {
      // We've reached capacity, so delete the oldest entry.
      const oldestKey = this.cache.keys().next().value;
      this.cache.delete(oldestKey);
    }
    this.cache.set(key, value); 
  }

  get size(): number {
    return this.cache.size;
  }
}
```
This implementation uses the JavaScript `Map` object which maintains insertion order, hence ideal for our LRU cache design. It throws an error if a non-positive or non-integer capacity is provided and properly implements the `get`, `set` and `size` methods as per the interface contract.